Download the PHP package smartive/handlebars-bundle without Composer

On this page you can find all versions of the php package smartive/handlebars-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package handlebars-bundle

Build Status Coverage Status Latest Stable Version Total Downloads License

SmartiveHandlebarsBundle

Bundle to integrate Handlebars templates into your Symfony2 / Symfony3 application.

This bundle renders handlebars with the help of xamin/handlebars.php.

Installation

Require the smartive/handlebars-bundle package in your composer.json and update your dependencies.

Register the bundle in app/AppKernel.php:

Configuration

Some of the features can be configured in the smartive_handlebars section of app/config/config.yml.

Handlebars file extension

The default file extension for Handlebars files is set to .hbs. This can be overridden using the following setting (example file extension set to .handlebars):

Template directories

The template_directories setting lets you define where to look for Handlebars templates. You can use Symfony resource notation as well as absolute file paths to configure directories.

By default, templates are getting search for in template directories recursively. You can disable this behaviour as follows:

Twig extension

The Handlebars Twig extension is enabled by default. To disable it add this to your configuration:

Usage

Rendering service

The smartive_handlebars.templating.renderer service offers a render($templateName, $data) method which can be use to render Handlebars templates.

Twig

To render Handlebars templates in Twig you can use the Twig function handlebars(templateName, data).

Custom Handlebars helpers

You can add you own Handlebars helpers as tagged services by implementing the Handlebars\Helper interface. To find out more about how to write custom helpers please have a look at the built-in helpers by xamin/handlebars.php.

Once you've implemented your own helper you have to register it as a service using the smartive_handlebars.helper tag and an appropriate alias:

You now can use your custom Handlebars helper inside your templates as follows:

Caching

The rendering service offers the ability to cache the parsed template between requests for faster rendering.

You can enable caching by setting smartive_handlebars.cache to a existing cache service ID in your app/config/config.yml:

There are several caching services / strategies available per default:

Disk

Service ID: smartive_handlebars.cache.disk

Uses Handlebars\Cache\Disk to read/write file cache in Symfony's cache directory

APC

Service ID: smartive_handlebars.cache.apc

Uses Handlebars\Cache\APC to read/write cache objects using APC

Redis

Service ID: smartive_handlebars.cache.redis

Uses PhpRedis or Predis to read/write cache objects using a Redis Server. This bundle integrates with RedisBundle in order to make configuring your Redis implementation even easier. The default Redis client being used is snc_redis.default (see RedisBundle documentation).

The default configuration can be overridden looks as follows:

Custom

You can also define your own caching services by adding a class which implements Handlebars\Cache. To use your custom cache service you have to register it in your service configuration:

Complete configuration example


All versions of handlebars-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
symfony/framework-bundle Version ^2.5|^3.0
symfony/finder Version ^2.5|^3.0
xamin/handlebars.php Version 0.10.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package smartive/handlebars-bundle contains the following files

Loading the files please wait ....