mickaelandrieu / twig-skill
Installs: 27
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:jarvis-skill
Requires
- twig/twig: ~1.2
Requires (Dev)
- phpunit/phpunit: 4.7.*
This package is auto-updated.
Last update: 2024-12-05 18:20:14 UTC
README
Installation
you need to install it using composer and then be sure that this configuration is available when Jarvis Application is started:
<?php require_once __DIR__.'/vendor/autoload.php'; $jarvis = new Jarvis\Jarvis([ 'container_provider' => [ 'Jarvis\Skill\Twig\ContainerProvider', ], 'twig' => [ 'templates_paths' => '/path/to/templates', ], ]);
Note that templates_paths
is a required parameter. This skill changes default values for some options:
debug
: if not provided, this value take the value of Jarvisdebug
parameter.auto_reload
: this is setted totrue
as default value in this skill.strict_variables
: this option is also setted totrue
by default.
You can see complete options list on Twig documentation.
<?php require_once('./../vendor/autoload.php'); require_once('./../config.php'); use Jarvis\Jarvis; /* ... */ $jarvis->router->addRoute('get', '/', function ($jarvis) { return $jarvis->twig->render('index.twig', ['world' => 'World']); }); $response = $jarvis->analyze(); $response->send();