Enabling Twig Debug Output


#1

Hello,

has anybody experience with printing template variables in a nice way? If i use the

{{ dump() }}

output function in the twig template I only get a really ugly plain text-output of the whole context. I remember in symfony there was a pretty js-aided black box with collapsible content. I am sure you just have to enable this behavior but i cannot figure out where. Enabling debug via

‘debug’ => true

in Twig config array doesn’t seems to be taken into account at all.

Thanks


#2

Hi!

The actual twig dumping functionality does not provide any fancy features ootb (https://twig.symfony.com/doc/2.x/functions/dump.html).

If you are aiming at the Symfony dumper functionality like here: https://symfony.com/blog/new-in-symfony-2-7-vardumper-improvements, which actually is already available by calling dump() in PHP code, you would have to wrap and register it your own Twig extension.

Best


#3

Yes!

Exactly what i need.

Many thanks