PHP code example of kzykhys / twig-extensions

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

    

kzykhys / twig-extensions example snippets

 php


use KzykHys\TwigExtensions\Loader\Filesystem;

$loader = new Filesystem('/path/to/templates');
$twig   = new Twig_Environment($loader);

$twig->render(array('date.twig', 'archive.twig', 'default.twig'));
 php


use KzykHys\TwigExtensions\ExtensionAggregate;

$loader = new Twig_Loader_Filesystem('/path/to/templates');
$twig   = new Twig_Environment($loader);

// Registers all extensions
$twig->setExtensions(ExtensionAggregate::getExtensions());