PHP code example of resist / twigphpfunctions

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

    

resist / twigphpfunctions example snippets


new TwigPhpFunctions(['ceil', 'floor']);

use resist\Twig\TwigPhpFunctions;
use const ALLOWED_PHP_FUNCTION_IN_TEMPLATES;

/** @var \Twig\Environment $twig */
$twig->addExtension(new TwigPhpFunctions(ALLOWED_PHP_FUNCTION_IN_TEMPLATES));