This package is abandoned and no longer maintained. No replacement package was suggested.

Keep track of your Symfony2 application's version

Fund package maintenance!

Installs: 7 413

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 2

Forks: 2

Open Issues: 0


v1.0.0 2012-06-29 16:08 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:20:55 UTC


Keep track of your Symfony2 application's version. Knowing what build/version number an application in staging/production is important.

Many projects have a VERSION or BUILD file created by the developer or CI server. This bundle provides a block, twig function, and web debug toolbar panel to output both the application's and Symfony's version. The version is available throughout your project as a service. You can inject the current version in perhaps a meta tag for your production environment.


  1. Install the bundle through composer :
    "require": {
        // ...
        "zenstruck/version-bundle": "dev-master"
  1. Create a VERSION file in your project's root directory

  2. Configure the bundle:

     # Example
     # app/config_dev.yml
         enabled: true
         toolbar: true
         enabled: true
         toolbar: false
             enabled: true


When enabled, this plugin defines two twig functions:

  • version(): outputs the current application version (as defined in your VERSION file)
  • symfony(): outputs the current Symfony version (as defined in Symfony\Component\HttpKernel\Kernel::VERSION)

And adds a service to Symfony's service container:

  • zenstruck.version.data_collector


Access service in a controller:

public function indexAction()
    $versionDC = $this->get('zenstruck.version.data_collector');

    $appVersion = $versionDC->getVersion();
    $symfonyVersion = $versionDC->getSymfony();

Render in template:

{# twig template #}
{{ version() }}
{{ symfony() }}

Render a meta tag with application version and Symfony version:

<meta name="version" content="{{ version() }}" />
<meta name="symfony" content="{{ symfony() }}" />


Use your own Version DataCollector

  1. Overrride the default VersionDataCollector class:

     // MyVersion.php
     use Zenstruck\Bundle\VersionBundle\DataCollector\VersionDataCollector;
     class MyVersion extends VersionDataCollector
         public function getVersion()
             return $myversion;
  2. Set you VersionDataCollector class in app/config.yml:

     // app/config.yml
         zenstruck.version.data_collector.class: \MyVersion

Full Default Configuration

# config.yml
    enabled: false                      # enable/disable service
    toolbar: false                      # show in web debug toolbar
    file: %kernel.root_dir%/../VERSION  # the file containing version info
    suffix: ~                           # suffix text (ie "-dev")
    version: ~                          # overrides file/text with custom version
      enabled: false                    # enable/disable block
      position: vb-bottom-right         # other values: vb-bottom-left, vb-top-right, vb-top-left
      prefix: "Version: "               # text added to beginning of block