PHP code example of alexmasterov / twig-extension

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

    

alexmasterov / twig-extension example snippets


/*
* @var $twig    Twig_Environment
* @var $request ServerRequestInterface
*/
$twig->addExtension(
    new AlexMasterov\TwigExtension\Psr7UriExtension(ServerRequestInterface $request)
);

$injector = new Auryn\Injector;
$injector->alias(
    Psr\Http\Message\ServerRequestInterface::class,
    Zend\Diactoros\ServerRequest::class
);

/*
* @var $twig Twig_Environment
*/
$twig->addExtension(
    $injector->make(AlexMasterov\TwigExtension\Psr7UriExtension::class)
);