PHP code example of rickselby / laravel-auto-presenter-mapper

1. Go to this page and download the library: Download rickselby/laravel-auto-presenter-mapper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rickselby / laravel-auto-presenter-mapper example snippets


RickSelby\LaravelAutoPresenterMapper\AutoPresenterMapperServiceProvider::class,

'Presenters' => \RickSelby\LaravelAutoPresenterMapper\Facades\AutoPresenterMapperFacade::class,

public function register()
{
    \Presenters::map(User::class, UserPresenter::class);
}

public function register()
{
    \Presenters::map([
        User::class => UserPresenter::class,
        ...
    ]);
}

public function show(User $user)
{
    \Presenters::map(User::class, UserJSONPresenter::class);
    ...
}

public function register()
{
    \Presenters::decorate(User::class);
    \Presenters::decorate([
        User::class,
        ...
    ]);
    ...
}