Timo Timo - 7 months ago 138
Twig Question

How to get config parameters in Symfony2 Twig Templates

I have a Symfony2 Twig template. I want to output the value of a config parameter in this twig template (a version number). Therefore I defined the config parameter like this:

app.version: 0.1.0

I'm able to use this config parameter in Controllers but I have no clue how to get it in my Twig template.


Easily, you can define in your config file:

        version: "0.1.0"

And access it in your template with

{{ version }}

Otherwise it must be a way with an Twig extension to expose your parameters.