Sometimes you need to see your variables or object in Twig template before printing it out. So to enable debug mode in twig template system you just need to tweak few settings upon initializing twig environment. Just follow the below code where I initiated Twig environment with debug mode.
<?php $twig = new Twig_Environment($loader, array( 'debug' => true, // ... )); $twig->addExtension(new Twig_Extension_Debug());
And inside your template where you want to dump the variable just write “. You can read more about dump function twig template from here