Skip to content
This repository has been archived by the owner on Jul 18, 2018. It is now read-only.
/ silex-mustache Public archive

Mustache.php service provider for the Silex microframework

License

Notifications You must be signed in to change notification settings

concedra/silex-mustache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MustacheServiceProvider

Provides integration with Mustache.php for the Silex microframework.

Parameters

  • mustache.extension: Extension for template and partials files. Defaults to mustache.
  • mustache.options: An array of options to be passed to the Mustache_Engine constructor.
  • mustache.templates_path (optional): Path to directory containing the templates.
  • mustache.partials_path (optional): Path to the directory containing partials.

If mustache.templates_path or mustache.partials_path are set and no corresponding loader is defined in mustache.options, filesystem loaders will be created automatically.

Services

  • mustache: The Mustache instance.

Usage Example

Registering with the application

$app->register(new \Concedra\Silex\MustacheServiceProvider(), array(
    'mustache.templates_path' => '/path/to/template_directory',
    'mustache.partials_path' => '/path/to/partials_directory',
));

Rendering content

// inside controller, will look for `template.mustache` in `mustache.templates_path`
$app['mustache']->render('template', array('variable' => 'value'));

See also

About

Mustache.php service provider for the Silex microframework

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages