5ichong / yaf-twig
Yaf 框架使用 Twig 作为模板引擎
v0.0.3
2023-08-14 06:13 UTC
Requires
- php: >=7.0
- ext-yaf: ^3.0
- twig/twig: *
Requires (Dev)
- phpunit/phpunit: ^6.2
This package is not auto-updated.
Last update: 2024-09-23 12:03:58 UTC
README
Yaf 使用 Twig 作为模板引擎
安装
要安装 Validator,只需
$ composer require 5ichong/yaf-twig
对于最新提交版本
$ composer require 5ichong/yaf-twig @dev
需求
Validator 与 7.0, 7.1 兼容。
快速开始与示例
添加到 application.ini
[product] application.view.ext = html [devel : product] application.twig.debug = true
添加到 index.php
require __DIR__ . '/vendor/autoload.php';
添加到 Bootstrap.php
use Yaf\Application; use Yaf\Dispatcher; public function _initView(Dispatcher $dispatcher) { $conf = Application::app()->getConfig(); $options = !empty($conf->twig) ? $conf->twig->toArray() : []; $twig = new \Aichong\Twig(APP_PATH . "/views/", $options); $dispatcher->setView($twig); }