PHP code example of caffeina-core / twig

1. Go to this page and download the library: Download caffeina-core/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/ */

    

caffeina-core / twig example snippets


View::addFilter('rot13',function($text){
  return str_rot13($text);
});

View::addGlobals([
  'BASE_URL'     => '/site/',
  'ASSETS_URL'   => '/site/assets/',
]);

View::addFunction('myFunction',function($a,$b,$c){
  return $a + $b + $c;
});
html
Value = <b>{{ myFunction(1,2,3) }}</b>