PHPackages                             quieteroks/yii-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. [Framework](/categories/framework)
4. /
5. quieteroks/yii-presenter

ActiveLibrary[Framework](/categories/framework)

quieteroks/yii-presenter
========================

Presenter for yii framework

1.0.1(6y ago)00GPL-3.0-or-laterPHPPHP &gt;=7.1.0

Since May 19Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Quieteroks/yii-presenter)[ Packagist](https://packagist.org/packages/quieteroks/yii-presenter)[ RSS](/packages/quieteroks-yii-presenter/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (4)Used By (0)

Yii2 presenter
==============

[](#yii2-presenter)

The presenter is view part of model layer. It retrieves data from the model, and formats for display in view.

The presenter is simple way to decorate model for view of you MVC framework. The best way for presenter is to convert model layer to view and replace view part itself.

But, you can put all view logic according to model in presenter and also provide all data for view from the presenter. All methods have to be encapsulated in common interface and after it they have to replace the presenter (maybe even with model) to fully change view part for other models.

Typical example of such presenters are following for CRUD operation in admin panel:

- Presenter for the model’s list through the GridView
- Presenter for specification of the model through the DetailView
- Presenter of the form for creation and updating models

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

[](#installation)

Install with composer cli:

```
composer require quieteroks/yii-presenter

```

Or add package in `composer.json` to `require` part:

```
"quieteroks/yii-presenter": "^1.0"

```

Usage
-----

[](#usage)

The presenter can decorate `array`, `object` or `yii\base\Model`and access all decorated type as presented object.

- Minimal presenter object:

```
/**
 * DocBlock for description all field
 */
class UserPresenter extends \quieteroks\presenter\Presenter
{
}
```

- The presenter can hide or rename base properties:

```
class UserPresenter extends \quieteroks\presenter\Presenter
{
    /**
     * @var array Protect password hash from access via presenter
     */
    protected $hidden = [
        'password_hash',
    ];
    /**
     * @var array Decorate to camelCase properties
     */
    protected $renamed = [
        'createdAt' => 'created_at',
        'updatedAt' => 'updated_at',
    ];
}
```

- The presenter can decorate and add property via getter method:

```
class UserPresenter extends \quieteroks\presenter\Presenter
{
    /**
     * Returns fullname property
     *
     * @return string
     */
    protected function getFullName()
    {
        return implode(' ', array_filter([
            $this->getRealPropertyValue('last_name'),
            $this->getRealPropertyValue('first_name'),
            $this->getRealPropertyValue('middle_name'),
        ]));
    }
}
```

Access priority
---------------

[](#access-priority)

The presenter finds and gives access to property in a priority:

- Pubic property of the presenter
- Getter method in the presenter
- Getter method in the decorated model
- Public properties in the decorated model

All getter method are wrapped in cameCase: `created_at => getCreatedAt`it’s also can be relevant for getter method in the decorated model. There is no access for methods like getCreated\_at.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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 ~0 days

Total

2

Last Release

2549d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e41e542a4f126ddd68063a7b570b7ad503d528ff16b05ee33417d0a9f43fa19b?d=identicon)[Quieteroks](/maintainers/Quieteroks)

---

Top Contributors

[![Quieteroks](https://avatars.githubusercontent.com/u/16535923?v=4)](https://github.com/Quieteroks "Quieteroks (10 commits)")

---

Tags

presenteryii2yii2-extensionframeworkyii2yiipresenter

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/quieteroks-yii-presenter/health.svg)

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

###  Alternatives

[dragon-code/support

Support package is a collection of helpers and tools for any project.

238.7M101](/packages/dragon-code-support)[skeeks/cms

SkeekS CMS — control panel and tools based on php framework Yii2

13825.6k47](/packages/skeeks-cms)[iiifx-production/yii2-autocomplete-helper

Yii2 Autocomplete Helper

4226.9k2](/packages/iiifx-production-yii2-autocomplete-helper)[tecnocen/yii2-formgenerator

Yii 2 Library to configure form generator

145.7k](/packages/tecnocen-yii2-formgenerator)

PHPackages © 2026

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