Skip to content

vinyvicente/phalcon-twig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phalcon-twig

Latest Stable Version Total Downloads License Monthly Downloads Daily Downloads composer.lock

Requirements

PHP >= 5.6
Phalcon >= 3.x

Install

composer require vinyvicente/phalcon-twig

Configuration

  • Register in your DI configuration view, registering new view engine.
    $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;
    };

Important

See Twig Docs: http://twig.sensiolabs.org/documentation

Enjoy!