seeren / controller
Manage action for http message
4.1.0
2022-01-08 14:09 UTC
Requires
- php: >=8.0.1
- psr/http-message: ~1.0.1
- seeren/container: ^3.0
- seeren/http: ^4.0
Requires (Dev)
- php-coveralls/php-coveralls: ^v2.5.2
- phpunit/phpunit: ^9.5
README
Manage action for http message
Installation
composer require seeren/controller
Seeren\Controller\JsonController
Retrieve PSR-7 Response for JSON format
use Seeren\Controller\JsonController; $controller = new JsonController(); $response = $controller->render(['foo' => 'bar']);
Seeren\Controller\HTMLController
Retrieve PSR-7 Response for HTML format
use Seeren\Controller\HTMLController; $controller = new HTMLController(); $response = $controller->render('template.html.php', [ 'title' => 'Hello World' ]);
By default, templates folder is in /templates
and include path can be specified at construction
project/ └─ templates/
Template use PHP syntax and values are sanitized by default
<h1><?= $title ?></h1>
License
This project is licensed under the MIT License