PHP code example of phive / twig-extensions-deferred

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

    

phive / twig-extensions-deferred example snippets


use Phive\Twig\Extensions\Deferred\DeferredExtension;
use Twig\Environment;

...

$twig = new Environment($loader);
$twig->addExtension(new DeferredExtension());

use Twig\Environment;

...

$twig = new Environment($loader);
$twig->addGlobal('assets', new ArrayObject());