mickaelandrieu / twig-skill
v0.2
2015-12-24 14:43 UTC
Requires
- twig/twig: ~1.2
Requires (Dev)
- phpunit/phpunit: 4.7.*
This package is auto-updated.
Last update: 2024-09-05 17:50:31 UTC
README
安装
您需要使用Composer安装它,然后确保在Jarvis应用程序启动时此配置可用
<?php require_once __DIR__.'/vendor/autoload.php'; $jarvis = new Jarvis\Jarvis([ 'container_provider' => [ 'Jarvis\Skill\Twig\ContainerProvider', ], 'twig' => [ 'templates_paths' => '/path/to/templates', ], ]);
注意,templates_paths
是一个必需的参数。此技能会更改某些选项的默认值
debug
:如果没有提供,此值将取Jarvisdebug
参数的值。auto_reload
:在此技能中默认设置为true
。strict_variables
:此选项默认也设置为true
。
您可以在Twig文档中查看完整的选项列表。
<?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();