The above given ans are correct and works fine. I used in a different way.
config.yml
imports: - { resource: parameters.yml } - { resource: security.yml } - { resource: app.yml } - { resource: app_twig.yml }
app.yml
parameters: app.version: 1.0.1
app_twig.yml
twig: globals: version: %app.version%
Inside controller:
$application_version = $this->container->getParameter('app.version'); // Here using app.yml
Inside template/twig file:
Project version {{ version }}! {# Here using app_twig.yml content. #} {# Because in controller we used $application_version #}
To use controller output:
Controller:
public function indexAction() { $application_version = $this->container->getParameter('app.version'); return array('app_version' => $application_version); }
template/twig file :
Project version {{ app_version }}
I mentioned the different for better understand.