Top menu

Enable the debug extension in Twig

To enable the debug function in twig. You have to modify the file app/config_dev.yml by adding the code below :

Then in your twig file (ex : test.html.twig) :

{% debug %} => Display all variables assigned to the template engine for the view in question

{% debug var %} => Displays information about the template variable “var”

This extension is deprecated as of Twig 1.5. Use the Twig built-in dump function instead.

NB : The debug tag only works when the debug environment option is set to true.

No comments yet.

Leave a Reply