lovelock/yaf-twig-adapter

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Twig adapter for Yet Another Framework.

v1.4 2016-02-29 05:27 UTC

This package is not auto-updated.

Last update: 2021-07-24 01:11:23 UTC


README

Build Status
Twig Adapter for Yaf PHP Framework with namespace enabled.

Installation

You can install via Composer.

At first create composer.json file:

{
	"require": {
		"lovelock/php-yaf-twig": ">=1.0"
	}
}

Run composer to install.

$ composer install

Finally, include vendor/autoload.php at index.php

require_once 'vendor/autoload.php';

Add to Bootstrap.php:

<?php

use \Yaf\Bootstrap_Abstract;
use \Yaf\Dispatcher;
use \Yaf\Application;
use \Lovelock\Yaf\Twig;

class Bootstrap extends Bootstrap_Abstract
{

	/**
	 * @param Dispatcher $dispatcher
	 */
	protected function _initTwig(Dispatcher $dispatcher)
	{
		$config = Application::app()->getConfig()
		$dispatcher->setView(new Twig(APP_PATH.'views', $config->twig->toArray()));
	}
}

Add to application.ini:

[product]

;app
application.view.ext = twig

;twig
twig.cache = APP_PATH "../cache"

[devel : product]

;twig
twig.debug = true

License

MIT license