PHP code example of taylornetwork / presenter

1. Go to this page and download the library: Download taylornetwork/presenter 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/ */

    

taylornetwork / presenter example snippets

 php
'providers' => [

    TaylorNetwork\Presenter\PresenterServiceProvider::class,

],
 bash
$ php artisan vendor:publish
 bash
$ php artisan make:presenter UserPresenter
 php
use TaylorNetwork\Presenter\Presenter;

class UserPresenter extends Presenter
{
    /**
     * Get the user's full name
     *
     * @return string
     */
    public function fullName()
    {
        return $this->model->first_name . ' ' . $this->model->last_name;
    }

    /**
     * Get the time since the user signed up
     *
     * @return string
     */
    public function userSince()
    {
        return $this->model->created_at->diffForHumans();
    }
}
 php
<h1>{{ $user->present()->fullName }}, you signed up {{ $user->present()->userSince }}</h1>