rrylee
10/19/2015 - 8:31 AM

how to start twig.

how to start twig.

<?php

require 'vendor/autoload.php';

$loader = new Twig_Loader_Filesystem('views');
$twig = new Twig_Environment($loader);

$md5Filter = new Twig_SimpleFilter('md5', function($string) {
    return md5($string);
});

$twig->addFilter($md5Filter);

$lexer = new Twig_Lexer($twig, [
    'tag_block'    => ['{', '}'],
    'tag_variable' => ['{{', '}}']
]);

$twig->setLexer($lexer);