suin / php-yaf-twig
Yet Another Framework的Twig扩展。
1.1
2012-08-28 10:51 UTC
Requires
- php: >=5.3.0
- twig/twig: >=1.9.1
This package is auto-updated.
Last update: 2024-09-06 08:50:56 UTC
README
Yet Another Framework的Twig扩展。
安装
您可以通过Composer进行安装。
首先创建composer.json
文件。
{ "require": { "suin/php-yaf-twig": ">=1.0" } }
运行Composer进行安装。
$ composer install
最后,在index.php
中包含vendor/autoload.php
。
require_once 'vendor/autoload.php';
添加到Bootstrap.php
。
<?php use \Suin\Yaf\Twig\Twig; class Bootstrap extends Yaf_Bootstrap_Abstract { /** * @param Yaf_Dispatcher $dispatcher */ protected function _initTwig(Yaf_Dispatcher $dispatcher) { $config = Yaf_Application::app()->getConfig() $dispatcher->setView(new Twig(APP_PATH.'views', $config->twig->toArray())); } }
添加到application.ini
。
[product] ;app application.view.ext = twig ;twig twig.cache = APP_PATH "../cache" [devel : product] ;twig twig.debug = true
许可证
MIT许可证