PHP code example of tequilarapido / presenter
1. Go to this page and download the library: Download tequilarapido/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/ */
tequilarapido / presenter example snippets
php
use Tequilarapido\Presenter\Presenter;
class UserPresenter extends Presenter {
public function name()
{
return $this->first_name . ' ' . $this->last_name;
}
}
php
$this->first_name
// or
$this->model->first_name
// or
$this->model->getAttribute('first_name')
php
$user = User::find(1);
// Retreive as property
$user->present()->name
// you can alse call the method
$user->present()->name()