PHP code example of yep / tracy-twig-extensions

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

    

yep / tracy-twig-extensions example snippets


php composer.phar 


$loader = new Twig_Loader_Filesystem(__DIR__);
$twig = new Twig_Environment($loader, ['debug' => true]);


use Yep\TracyTwigExtensions\DumpExtension;
$twig->addExtension(new DumpExtension());

// If you want to see dump in colors, you must enable Tracy\Debugger
// use Tracy\Debugger;
// Debugger::enable(Debugger::DEVELOPMENT);

// You can specify dump options
$options = [
	Tracy\Dumper::DEPTH => 5,
	Tracy\Dumper::TRUNCATE => 500
];
$twig->addExtension(new DumpExtension($options));


use Yep\TracyTwigExtensions\BarDumpExtension;
use Tracy\Debugger;

Debugger::enable(Debugger::DEVELOPMENT);
$twig->addExtension(new BarDumpExtension());

// You can specify dump options
$options = [
	Tracy\Dumper::DEPTH => 5,
	Tracy\Dumper::TRUNCATE => 500
];
$twig->addExtension(new BarDumpExtension($options));