Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kint-php/kint-twig
Twig extension for Kint integration
https://github.com/kint-php/kint-twig
debug dev developer-tools kint php twig
Last synced: about 2 months ago
JSON representation
Twig extension for Kint integration
- Host: GitHub
- URL: https://github.com/kint-php/kint-twig
- Owner: kint-php
- License: gpl-3.0
- Created: 2017-06-16T22:18:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-11-17T14:48:50.000Z (about 1 year ago)
- Last Synced: 2024-10-31T23:34:08.413Z (2 months ago)
- Topics: debug, dev, developer-tools, kint, php, twig
- Language: PHP
- Size: 99.6 KB
- Stars: 12
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kint-Twig
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
```php
$twig->addExtension(new Kint\Twig\TwigExtension());
``````twig
{{ d(data, richMode, moreData, evenMoreData) }}{{ s(data, plainMode) }}
```Custom function names dumpers:
```php
$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() }}
```