Standalone Symfony Var Dumper Twig extension.
composer require hellonico/twig-dump-extension
$twig = new Twig_Environment($loader, $options);
$twig->addExtension(new HelloNico\Twig\DumpExtension());
In Twig templates:
{{ dump(foo) }}
{% dump foo %}
{% dump foo, bar %}
Set some dumper options with the hellonico/var-dumper-configurator
package:
composer req hellonico/var-dumper-configurator --dev
See https://github.com/nlemoine/var-dumper-configurator for configuration.