Symfony: find all default global variables in twig

Twig ships with some default global variables that you can use. Where does this variables come from?

app/console twig:debug

You will see a Globals section. Take the ‘app’ variable for example, you can find all the variables available in that file. That is why {{ app.user }} works. To see all the variables in app.user, {{ dump(app.user) }}

Author: bpeh

Bernard Peh is a great passioner of web technologies and one of the co-founder of Sitecritic.net Website Design and Reviews. He works with experienced web designers and developers everyday, developing and designing commercial websites. He specialises mainly in SEO and PHP programming.