Do you sometimes wish you could just do a var_dump inside a Twig template while trying to debug some code? Well Twig comes with its own Debug extension to allow you to do just that.
Firstly, add the following to your /app/config/config_dev.yml (you don’t want to do this on Prod):
twig:
    debug: 1
services:
    debug.twig.extension:
        class: Twig_Extensions_Extension_Debug
        tags: [{ name: 'twig.extension' }]
Now inside your Twig templates you can “var_dump” variables using the built-in Twig Debug:
 {% debug nameOfVariable %} 
Happy debugging!