mattmezza / slim-handlebars-view
Handlebars View for Slim Framework
1.1.1
2017-04-03 19:47 UTC
Requires
- php: >=5.5.0
- justblackbird/handlebars.php-helpers: ^1.1
- psr/http-message: ^1.0
- slim/slim: ^3.0
- xamin/handlebars.php: ~0.10.4
Requires (Dev)
- phpunit/phpunit: ^4.8|^5.7
This package is auto-updated.
Last update: 2025-01-17 10:06:38 UTC
README
This is a Slim Framework view helper built on top of the Handlebars templating component. You can use this component to create and render templates in your Slim Framework application. It works with handlebars.php by xamin project.
Install
Via Composer
$ composer require mattmezza/slim-handlebars-view
Requires Slim Framework 3 and PHP 5.5.0 or newer.
Usage
// Create Slim app $app = new \Slim\App(); // Fetch DI Container $container = $app->getContainer(); // Register Twig View helper $container['view'] = new \Slim\Views\Handlebars( 'path/to/templates', 'partials', [ 'extension' => 'hbs' // default is html ]); // Define named route $app->get('/hello/{name}', function ($request, $response, $args) { return $this->view->render($response, 'profile', [ 'name' => $args['name'] ]); })->setName('profile'); // Run app $app->run();
Testing
phpunit
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.