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):
    debug: 1
        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!