1. Go to this page and download the library: Download jordan-adams/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/ */
jordan-adams / presenter example snippets
use JordanAdams\Presenter\Presenter;
use JordanAdams\Presenter\PresentableTrait;
class MyModel {
use PresentableTrait;
protected $presenter = 'MyPresenter';
protected $firstName = 'Jordan';
protected $surname = 'Adams';
}
class MyPresenter extends Presenter {
public function fullName() {
return $this->model->firstName . ' ' . $this->model->surname; // Jordan Adams
}
}
use JordanAdams\Presenter\Presenter;
class MyModel {
protected $presenter = 'MyPresenter';
protected $firstName = 'Jordan';
protected $surname = 'Adams';
public function presenter() {
return new $this->presenter($this);
}
}
class MyPresenter extends Presenter {
public function fullName() {
return $this->model->firstName . ' ' . $this->model->surname;
}
}
$model = new MyModel();
$model->presenter()->fullName() // Jordan Adams
$model->presenter()->fullName // Jordan Adams
$model->presenter()->firstName // Jordan
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.