PHPackages                             tooleks/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. tooleks/laravel-presenter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tooleks/laravel-presenter
=========================

The Laravel Presenter Package

2.0.2(8y ago)371MITPHPPHP ^7.0

Since Dec 8Pushed 8y ago1 watchersCompare

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

READMEChangelog (5)Dependencies (4)Versions (8)Used By (0)

The Laravel Presenter Package
=============================

[](#the-laravel-presenter-package)

The package provides the `Presenter` layer for wrapping model objects into new presentations.

Features
--------

[](#features)

The package supports:

- Objects and arrays presentation
- Data mapping
- Nested attributes
- Attributes overriding
- The Laravel 5.2 collections
- JSON serialization
- Casting to array/JSON
- Injections into the constructor

Requirements
------------

[](#requirements)

"php": "^7.0", "illuminate/support": "^5.2", "illuminate/contracts": "^5.2"

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

[](#installation)

### Package Installation

[](#package-installation)

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

```
composer require tooleks/laravel-presenter
```

### App Configuration

[](#app-configuration)

To register the service provider simply add the `Tooleks\Laravel\Presenter\Providers\PresenterProvider::class` into your `config/app.php` to the end of the `providers` array:

```
'providers' => [
    ...
    Tooleks\Laravel\Presenter\Providers\PresenterProvider::class,
],
```

Usage Examples
--------------

[](#usage-examples)

### Model Presentation

[](#model-presentation)

To define your presenter class, you need to extend base `Tooleks\Laravel\Presenter\Presenter` class, as shown in the example below.

Override the `getAttributesMap()` method to build attributes map definition.

```
