Install via composer:
$ composer require caffeina-core/twig -o
Twig documentation : http://twig.sensiolabs.org/documentation
View::addFilter('rot13',function($text){
return str_rot13($text);
});
<li>test = {{ test|rot13 }}</li>
Outputs :
<li>test = grfg</li>
View::addGlobals([
'BASE_URL' => '/site/',
'ASSETS_URL' => '/site/assets/',
]);
<script src="{{ ASSETS_URL }}js/main.js"></script>
View::addFunction('myFunction',function($a,$b,$c){
return $a + $b + $c;
});
Value = <b>{{ myFunction(1,2,3) }}</b>
Outputs :
Value = <b>6</b>