PHP code example of kint-php / kint-twig

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

    

kint-php / kint-twig example snippets


$twig->addExtension(new Kint\Twig\TwigExtension());

$ext = new Kint\Twig\TwigExtension();

$aliases = $ext->getAliases();

// Different alias for existing dumper
$aliases['dump'] = $aliases['d'];

// Custom dumper
$text = new Kint\Kint(new Kint\Parser\Parser(), new Kint\Renderer\TextRenderer());
$text->setStatesFromStatics(Kint\Kint::getStatics());

$aliases['text'] = $text;

$ext->setAliases($aliases);

$twig->addExtension($ext);
twig
{{ dump() }}
{{ text() }}