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.10(1mo ago)47252.8k↓60.2%8[1 issues](https://github.com/guilhermegonzaga/presenter/issues)MITPHPPHP &gt;=5.4.0CI failing

Since Jan 20Pushed 1mo ago2 watchersCompare

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

READMEChangelog (10)Dependencies (6)Versions (12)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

58

—

FairBetter than 98% of packages

Maintenance89

Actively maintained with recent releases

Popularity46

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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 ~376 days

Recently: every ~387 days

Total

11

Last Release

53d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12283475?v=4)[Guilherme Gonzaga](/maintainers/guilhermegonzaga)[@guilhermegonzaga](https://github.com/guilhermegonzaga)

---

Top Contributors

[![guilhermegonzaga](https://avatars.githubusercontent.com/u/12283475?v=4)](https://github.com/guilhermegonzaga "guilhermegonzaga (18 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

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M195](/packages/laravel-ai)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.5M2](/packages/glushkovds-phpclickhouse-laravel)

PHPackages © 2026

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