PHP code example of buzzingpixel / twig-truncate

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



declare(strict_types=1);

use corbomite\di\Di;
use Twig\Environment;
use Twig\Loader\FilesystemLoader;
use buzzingpixel\twigtruncate\TruncateTwigExtension;

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

$twig->addExtension(Di::get(TruncateTwigExtension::class));