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

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

padosoft/laravel-presenter
==========================

Implementation for Laravel of the presenter design pattern.

1.6.0(1y ago)112.7k↓45%[1 PRs](https://github.com/padosoft/laravel-presenter/pulls)MITPHPPHP &gt;=7.4

Since Jan 20Pushed 9mo ago1 watchersCompare

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

READMEChangelog (2)Dependencies (5)Versions (11)Used By (0)

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

[](#laravel-presenter)

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.

[![Latest Version on Packagist](https://camo.githubusercontent.com/a6c27412b85a61755e66d594384517b7b26a2f1906041ce548e32440ec2805ff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7061646f736f66742f6c61726176656c2d70726573656e7465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/padosoft/laravel-presenter)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Quality Score](https://camo.githubusercontent.com/23d3be34ad4e1974a2376a248c83f65969d593d586e045f9040f72a11032d29a/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7061646f736f66742f6c61726176656c2d70726573656e7465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/padosoft/laravel-presenter)[![Total Downloads](https://camo.githubusercontent.com/3db57ff987ce0154f57a0e4fbcff05f028f5adac3742b34e58dc917a7c687a1e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7061646f736f66742f6c61726176656c2d70726573656e7465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/padosoft/laravel-presenter)

Table of Contents
=================

[](#table-of-contents)

- [Laravel Package that implement presenter pattern.](#laravel-package-that-implement-presenter-pattern)
    - [Requires](#requires)
    - [Installation](#installation)
    - [USAGE](#usage)
    - [Change log](#change-log)
    - [Testing](#testing)
    - [Contributing](#contributing)
    - [Security](#security)
    - [Credits](#credits)
    - [About Padosoft](#about-padosoft)
    - [License](#license)

\##Requires

- "php" : "&gt;=5.6.0",
- "illuminate/support": "~5.0|^6.0|^7.0|^8.0|^9.0",
- "illuminate/database": "~5.0|^6.0|^7.0|^8.0|^9.0"

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

[](#installation)

#### Laravel 5.x

[](#laravel-5x)

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

```
composer require padosoft/laravel-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 }}
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email instead of using the issue tracker.

Credits
-------

[](#credits)

- [Lorenzo Padovani](https://github.com/lopadova)
- [All Contributors](../../contributors)

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

About Padosoft
--------------

[](#about-padosoft)

Padosoft () is a software house based in Florence, Italy. Specialized in E-commerce and web sites.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance52

Moderate activity, may be stable

Popularity27

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 54.5% 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 ~420 days

Recently: every ~404 days

Total

9

Last Release

407d ago

PHP version history (3 changes)1.0PHP &gt;=5.4.0

1.0.2PHP &gt;=5.6.0

1.3.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/9fabb1f16f7a29a235494893175d25d51628fe2a6c9052834e35abe0666c9a8e?d=identicon)[lopadova](/maintainers/lopadova)

---

Top Contributors

[![lopadova](https://avatars.githubusercontent.com/u/10467699?v=4)](https://github.com/lopadova "lopadova (6 commits)")[![leopado](https://avatars.githubusercontent.com/u/20923180?v=4)](https://github.com/leopado "leopado (5 commits)")

---

Tags

laravellaravel-packagepatternpresenterviewviewpresenterlaravel-presenterpadosoftpresent

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[laracasts/presenter

Simple view presenters

8643.4M46](/packages/laracasts-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)[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)
