If you want to dynamically display the version of Symfony 2 on pages, for example, in the footer, you can do it like this.
create service
<?php namespace Project\Bundle\DuBundle\Twig; class SymfonyVersionExtension extends \Twig_Extension { public function getFunctions() { return array(
Register at service.yml
dut.twig.symfony_version_extension: class: Project\Bundle\DutBundle\Twig\SymfonyVersionExtension tags: - { name: twig.extension } #arguments: []
And you can call him anywhere. In the controller, wrap it in JSON or in the footer
<p> Built With Symfony {{ symfony_version() }} Version MIT License</p>
Now, every time you run an update for the composer to update your provider, the symfony version also automatically updates in your template. I know this is too much, but this is how I do it in my projects and it works
rai Dec 01 '15 at 2:37 2015-12-01 02:37
source share