kint-php / kint-twig
Twig extension for Kint integration
Installs: 379 287
Dependents: 6
Suggesters: 5
Security: 0
Stars: 12
Watchers: 4
Forks: 1
Open Issues: 0
Requires
- php: >=7.1
- kint-php/kint: ^4 || ^5
- twig/twig: ^2.4 || ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3
- phpunit/phpunit: ^9.0
- vimeo/psalm: ^5@dev
README
A Twig extension providing the familiar Kint functionality for dumping data.
Note that features like the mini-trace, variable name detection, and modifiers will not work from inside twig templates.
Usage
$twig->addExtension(new Kint\Twig\TwigExtension());
{{ d(data, richMode, moreData, evenMoreData) }} {{ s(data, plainMode) }}
Custom function names dumpers:
$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);
{{ dump() }}
{{ text() }}