PHPackages                             guilhermegonzaga/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. guilhermegonzaga/presenter

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

guilhermegonzaga/presenter
==========================

Implementation for Laravel of the presenter design pattern.

1.0.9(1y ago)47242.1k↓18.4%7[1 issues](https://github.com/guilhermegonzaga/presenter/issues)MITPHPPHP &gt;=5.4.0CI failing

Since Jan 20Pushed 1y ago2 watchersCompare

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

READMEChangelog (10)Dependencies (3)Versions (11)Used By (0)

Laravel Presenter
=================

[](#laravel-presenter)

[![Latest Stable Version](https://camo.githubusercontent.com/ad9ca394089d1f0453a7c11c9ceae2a742e89c2d0195b2df978e9defd62a6c23/68747470733a2f2f706f7365722e707567782e6f72672f6775696c6865726d65676f6e7a6167612f70726573656e7465722f762f737461626c65)](https://packagist.org/packages/guilhermegonzaga/presenter) [![Total Downloads](https://camo.githubusercontent.com/bb78142d54287dac7d6cad4e4e7fd42254ff8c8ca2583ca960488a506d5faac8/68747470733a2f2f706f7365722e707567782e6f72672f6775696c6865726d65676f6e7a6167612f70726573656e7465722f646f776e6c6f616473)](https://packagist.org/packages/guilhermegonzaga/presenter) [![Latest Unstable Version](https://camo.githubusercontent.com/fe3819c09ff3eefa52c51d0aed8793052726191bf537885deb2615207a28db57/68747470733a2f2f706f7365722e707567782e6f72672f6775696c6865726d65676f6e7a6167612f70726573656e7465722f762f756e737461626c65)](https://packagist.org/packages/guilhermegonzaga/presenter) [![License](https://camo.githubusercontent.com/c63183b759993561678953cca54344b4d54a6e39a37b468f71559102aa239c18/68747470733a2f2f706f7365722e707567782e6f72672f6775696c6865726d65676f6e7a6167612f70726573656e7465722f6c6963656e7365)](https://packagist.org/packages/guilhermegonzaga/presenter)[![PHPUnit Test](https://github.com/guilhermegonzaga/presenter/workflows/PHPUnit%20Test/badge.svg?event=push)](https://github.com/guilhermegonzaga/presenter/workflows/PHPUnit%20Test/badge.svg?event=push)

Presenter is a design pattern for Laravel which is used to modify the data that comes from your model to your views.
It causes the data to be displayed in a way understandable to humans.

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

[](#installation)

#### Laravel (5.x|6.x|7.x|8.x|9.x|10.x|11.x|12.x)

[](#laravel-5x6x7x8x9x10x11x12x)

Execute the following command to get the latest version of the package:

```
composer require guilhermegonzaga/presenter

```

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.
Note that your presenter class must extend `Laracodes\Presenter\Presenter`:

```
namespace App\Presenters;

use Laracodes\Presenter\Presenter;

class UserPresenter extends Presenter
{
    public function fullName()
    {
        return $this->model->first_name . ' ' . $this->model->last_name;
    }

    public function accountAge()
    {
        return $this->model->created_at->diffForHumans();
    }

    ...
}
```

Next, on your model, pull in the `Laracodes\Presenter\Traits\Presentable` trait, which will automatically instantiate your presenter class:

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Laracodes\Presenter\Traits\Presentable;

class User extends Model
{
    use Presentable;

    protected $presenter = 'App\Presenters\UserPresenter';

    ...
}
```

Done, now you can call it in your views:

```
Hello, {{ $user->present()->fullName }}
Hello, {{ $user->present()->full_name }} // automatically convert to camelCase
```

Notice how the call to the present() method (which will return your new or cached presenter object) also provides the benefit of making it perfectly clear where you must go, should you need to modify how a full name is displayed on the page.

Notices
-------

[](#notices)

When you call a method that does not exist in its class presenter, this package will automatically call the property in the model with conversion to snake\_case.

Ex:

```
// automatically calls the property in the model
Hello, {{ $user->present()->firstName }} // automatically convert to snake_case
Hello, {{ $user->present()->first_name }}
```

Credits
-------

[](#credits)

This package is largely inspired by [this](https://github.com/laracasts/Presenter) great package by @laracasts.

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance44

Moderate activity, may be stable

Popularity47

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 73.9% 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 ~370 days

Recently: every ~407 days

Total

10

Last Release

440d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5884862a02d508dafc65e4f2fa50227ab0d9cb2db23b9a2b99227528f8ca4714?d=identicon)[guilhermegonzaga](/maintainers/guilhermegonzaga)

---

Top Contributors

[![guilhermegonzaga](https://avatars.githubusercontent.com/u/12283475?v=4)](https://github.com/guilhermegonzaga "guilhermegonzaga (17 commits)")[![GC-Max](https://avatars.githubusercontent.com/u/10233281?v=4)](https://github.com/GC-Max "GC-Max (2 commits)")[![MaxGiting](https://avatars.githubusercontent.com/u/9828591?v=4)](https://github.com/MaxGiting "MaxGiting (2 commits)")[![conroyp](https://avatars.githubusercontent.com/u/143244?v=4)](https://github.com/conroyp "conroyp (1 commits)")[![JayBizzle](https://avatars.githubusercontent.com/u/340752?v=4)](https://github.com/JayBizzle "JayBizzle (1 commits)")

---

Tags

entitylaravelphppresenterviewlaravelentityviewpresenter

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[laracasts/presenter

Simple view presenters

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

Simple view presenter library for Laravel.

174.7k](/packages/lewis-presenter)[deefour/presenter

Presenters/Decorators for PHP Objects

122.5k](/packages/deefour-presenter)

PHPackages © 2026

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