PHP code example of vinyvicente / phalcon-twig
1. Go to this page and download the library: Download vinyvicente/phalcon-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/ */
vinyvicente / phalcon-twig example snippets
$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;
};