2017 © Pedro Peláez
 

library slim-handlebars-view

Slim Framework 3 view helper built on top of the Handlebars templating component

image

jamiecressey/slim-handlebars-view

Slim Framework 3 view helper built on top of the Handlebars templating component

  • Wednesday, October 7, 2015
  • by jayc89
  • Repository
  • 1 Watchers
  • 0 Stars
  • 471 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Slim Framework Handlebars View

Build Status, (*1)

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., (*2)

Install

Via Composer, (*3)

$ composer require jamiecressey/slim-handlebars-view

Requires Slim Framework 3 and PHP 5.5.0 or newer., (*4)

Usage

// Create Slim app
$app = new \Slim\App();

// Fetch DI Container
$container = $app->getContainer();

// Register Handlebars View helper
$container['view'] = function ($c) {
    $view = new \Slim\Views\Handlebars('path/to/templates', [
        'extension' => 'handlebars'
    ]);

    return $view;
};

// Define named route
$app->get('/hello/{name}', function ($request, $response, $args) {
    return $this->view->render($response, 'profile.html', [
        'name' => $args['name']
    ]);
})->setName('profile');

// Run app
$app->run();

Custom template functions

This component exposes a custom path_for() function to your Handlebars templates. You can use this function to generate complete URLs to any Slim application named route. This is an example Handlebars template:, (*5)

{{>layout}}

<h1>User List</h1>
<ul>
    <li><a href="{{ path_for('profile', { 'name': 'josh' }) }}">Josh</a></li>
</ul>

Testing

phpunit

Contributing

Please see CONTRIBUTING for details., (*6)

Security

If you discover any security related issues, please email jamiecressey89@gmail.com instead of using the issue tracker., (*7)

Credits

License

The MIT License (MIT). Please see License File for more information., (*8)

The Versions

07/10 2015

dev-master

9999999-dev http://slimframework.com

Slim Framework 3 view helper built on top of the Handlebars templating component

  Sources   Download

MIT

The Requires

 

The Development Requires

framework template handlebars slim view

07/10 2015

0.0.2

0.0.2.0 http://slimframework.com

Slim Framework 3 view helper built on top of the Handlebars templating component

  Sources   Download

MIT

The Requires

 

The Development Requires

framework template handlebars slim view

05/10 2015

0.0.1

0.0.1.0 http://slimframework.com

Slim Framework 3 view helper built on top of the Handlebars templating component

  Sources   Download

MIT

The Requires

 

The Development Requires

framework template handlebars slim view