PHP code example of 5ichong / yaf-twig
1. Go to this page and download the library: Download 5ichong/yaf-twig library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
5ichong / yaf-twig example snippets
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);
}