eric-chau / twig-skill
Installs: 108
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/eric-chau/twig-skill
Requires
- twig/twig: ~1.25.0
This package is not auto-updated.
Last update: 2025-10-11 23:17:00 UTC
README
This skill is an integration of Twig into Jarvis micro-framework.
What it brings
When this skill is enabled, it brings:
$app['twig']service, an unique instance of\Twig_Environment.- On
$app['twig']first call, the eventJarvis\Skill\Twig\TwigReadyEvent(event name:twig.ready) will be broadcasted. Note thatTwigReadyEventis a permanent event. - In all Twig templates, the variable
router(=$app['router']) is available.
Configuration options
You must add a 'twig' key in the 'extra' section to pass your options:
<?php require_once __DIR__ . '/vendor/autoload.php'; $app = new Jarvis\Jarvis([ 'providers' => [ 'Jarvis\Skill\Twig\TwigCore', ], 'extra' => [ twig' => [ 'templates_paths' => '/path/to/templates', ], ], ]);
Note that templates_paths is a required parameter. Other options:
debug: if not provided, Jarvisdebugparameter is used.auto_reload:trueby default.strict_variables:trueby default.
You can see complete options list on Twig documentation.