jsangrador / phptal-view
This package is abandoned and no longer maintained.
No replacement package was suggested.
Render PHPTAL view templates into a PSR-7 Response object.
3.0.0
2016-01-21 23:14 UTC
Requires
- phptal/phptal: ~1.3
- psr/http-message: ^1.0
Requires (Dev)
- phpunit/phpunit: ^4.0
- slim/slim: ^3.0
README
Development of this fork has been moved to https://gitlab.com/jsangradorp/PHPTAL-View
PHPTAL Renderer
This is a renderer for rendering PHPTAL view scripts into a PSR-7 Response object. It works well with Slim Framework 3.
Installation
Install with Composer:
composer require jsangrador/PHPTAL-view
Usage With Slim 3
use Slim\Views\PhpTalRenderer; include "vendor/autoload.php"; $app = new Slim\App(); $container = $app->getContainer(); $container['renderer'] = new PhpTalRenderer("./templates"); $app->get('/hello/{name}', function ($request, $response, $args) { return $this->renderer->render($response, "/hello.html", $args); }); $app->run();
Usage with any PSR-7 Project
//Construct the View $phpView = new PhpTalRenderer("./path/to/templates"); //Render a Template $response = $phpView->render(new Response(), "/path/to/template.html", $yourData);
Exceptions
\RuntimeException
- if template does not exist
\InvalidArgumentException
- if $data contains 'template'