vinnyvicente / phalcon-twig
Phalcon PHP 的 Twig 视图处理器
v2.0
2023-08-23 17:59 UTC
Requires
- php: >=7.1.3
- twig/twig: ^1.28 || ~2.0
Requires (Dev)
- phalcon/ide-stubs: ^3.3
This package is auto-updated.
Last update: 2024-09-23 20:28:18 UTC
README
要求
PHP >= 5.6
Phalcon >= 3.x
安装
composer require vinyvicente/phalcon-twig
配置
- 在DI配置视图中注册,注册新的视图引擎。
$di = new \Phalcon\Di\FactoryDefault(); $di['view'] = function () { $view = new View(); $view->setViewsDir('app/views/'); $view->registerEngines([ View\Engine\Twig::DEFAULT_EXTENSION => function ($view, $di) { return new View\Engine\Twig($view, $di, [ 'cache' => __DIR__ . '/app/cache/', ]); } ]); return $view; };
重要
See Twig Docs: http://twig.sensiolabs.org/documentation
享受!