2017 © Pedro Peláez
 

library slim-handlebars

Handlebars View Parser package for the Slim Framework

image

jayc89/slim-handlebars

Handlebars View Parser package for the Slim Framework

  • Friday, January 30, 2015
  • by jayc89
  • Repository
  • 1 Watchers
  • 1 Stars
  • 185 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Slim Handlebars

Latest Stable Version Total Downloads Bitdeli Badge, (*1)

This repository contains a custom View class for Handlebars (https://github.com/mardix/Handlebars). You can use the custom View class by either requiring the appropriate class in your Slim Framework bootstrap file and initialize your Slim application using an instance of the selected View class or using Composer (the recommended way)., (*2)

How to Install

using Composer

Create a composer.json file in your project root:, (*3)

{
    "require": {
        "jayc89/slim-handlebars": "dev-master"
    }
}

Then run the following composer command:, (*4)

$ php composer.phar install

How to use

<?php
require 'vendor/autoload.php';

$app = new \Slim\Slim(array(
    'view' => new \Slim\Handlebars\Handlebars()
));

To use Handlebars options do the following:, (*5)

$view = $app->view();
$view->parserOptions = array(
    'charset' => 'ISO-8859-1'
);

Templates (suffixed with .handlebars) are assumed to be located within Slim's template directory (<doc root>/templates, by default). Partials are picked up from <template directory>/partials., (*6)

Constructor takes an array as a parameter. The following properties are supported:, (*7)

  • partialsDirectory
  • templateExtensions

To render the templates within your routes:, (*8)

$app->get('/', function () use ($app) {
    $array = array();
    $app->render("home", $array);
});

Authors

Jamie Cressey, (*9)

License

MIT Public License, (*10)

The Versions

30/01 2015

dev-master

9999999-dev http://github.com/jayc89/Slim-Handlebars

Handlebars View Parser package for the Slim Framework

  Sources   Download

MIT

The Requires

 

templating extensions handlebars slimphp