PHP code example of buzzingpixel / twig-switch

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

    

buzzingpixel / twig-switch example snippets



declare(strict_types=1);

use Twig\Environment;
use Twig\Loader\FilesystemLoader;
use buzzingpixel\twigswitch\SwitchTwigExtension;

$twig = new Environment(new FilesystemLoader('/path/to/templates'), [
    'debug' => true,
    'cache' => '/path/to/cache',
    'strict_variables' => true,
]);

$twig->addExtension(new SwitchTwigExtension());