PHPackages                             frostealth/php-presenter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. frostealth/php-presenter

ActiveLibrary[Templating &amp; Views](/categories/templating)

frostealth/php-presenter
========================

Simple View Presenters

v0.1.1(10y ago)110.3k1MITPHPPHP &gt;=5.4

Since Dec 12Pushed 10y ago1 watchersCompare

[ Source](https://github.com/frostealth/php-presenter)[ Packagist](https://packagist.org/packages/frostealth/php-presenter)[ RSS](/packages/frostealth-php-presenter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (1)

PHP View Presenters
===================

[](#php-view-presenters)

So you have those scenarios where a bit of logic needs to be performed before some data (likely from your entity) is displayed from the view.

- Should that logic be hard-coded into the view? **No.**
- Should we instead store the logic in the model? **No again!**

Instead, leverage view presenters. That's what they're for! This package provides one such implementation.

Installation
------------

[](#installation)

Run the [Composer](http://getcomposer.org/download/) command to install the latest stable version:

```
composer require frostealth/php-presenter @stable
```

Usage
-----

[](#usage)

The first step is to store your presenters somewhere - anywhere. These will be simple objects that do nothing more than format data, as required.

Here's an example of a presenter.

```
namespace app\presenters;

use frostealth\presenter\Presenter;

/**
 * Class ConcreteEntityPresenter
 *
 * @property-read string $fullName
 * @property-read string $birthDate
 */
class ConcreteModelPresenter extends Presenter
{
    /**
     * @return string
     */
    public function getFullName()
    {
        return implode(' ', [$this->firstName, $this->lastName]);
    }

    /**
     * @return string
     */
    public function getBirthDate()
    {
        return date('y.M.d', $this->entity->birthDate);
    }
}
```

Here's an example of an presentable model.

```
namespace app\models;

use app\presenters\ConcreteModelPresenter;
use frostealth\presenter\interfaces\PresentableInterface;

class ConcreteModel implements PresentableInterface
{
    /** @var string */
    public $firstName;

    /** @var string */
    public $lastName;

    /** @var string */
    public $birthDate;

    /** @var ConcreteModelPresenter */
    protected $presenter;

    /**
     * @return ConcreteModelPresenter
     */
    public function presenter()
    {
        if ($this->presenter === null) {
            $this->presenter = new ConcreteModelPresenter($this);
        }

        return $this->presenter;
    }
}
```

Now, within your view, you can do:

```

    Name

    Birth Date

```

License
-------

[](#license)

The MIT License (MIT). See [LICENSE.md](https://github.com/frostealth/php-presenter/blob/master/LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

2

Last Release

3808d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3209d007425f192de0e0941e6181d2dfd36ed4f00714675ca7fb525c6fd27ed2?d=identicon)[frostealth](/maintainers/frostealth)

---

Top Contributors

[![frostealth](https://avatars.githubusercontent.com/u/1785217?v=4)](https://github.com/frostealth "frostealth (3 commits)")

---

Tags

phppresenterviewpresenter

### Embed Badge

![Health badge](/badges/frostealth-php-presenter/health.svg)

```
[![Health](https://phpackages.com/badges/frostealth-php-presenter/health.svg)](https://phpackages.com/packages/frostealth-php-presenter)
```

###  Alternatives

[laracasts/presenter

Simple view presenters

8643.4M46](/packages/laracasts-presenter)[robclancy/presenter

Decorate your objects using presenters. Primarily to keep presentation logic out of your models.

3451.1M8](/packages/robclancy-presenter)[guilhermegonzaga/presenter

Implementation for Laravel of the presenter design pattern.

47242.1k](/packages/guilhermegonzaga-presenter)[view-components/view-components

Flexible Framework-Agnostic UI for Enterprise Web Applications

2498.7k7](/packages/view-components-view-components)[frostealth/yii2-presenter

Yii2 View Presenter

1310.3k](/packages/frostealth-yii2-presenter)[lewis/presenter

Simple view presenter library for Laravel.

174.7k](/packages/lewis-presenter)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
