Best practice for displaying Symfony application version for user?

We built a build of web applications on top of the Symfony2 framework.

Now we need to display the current version of our software in the interface for viewing by the user. The version number is currently a tag in the git repository.

Now, what is considered best practice to achieve this? Composer documentation prevents using the version field used in composer.json

Symfony itself seems to set the version line in the app/bootstrap.php.cache file: const VERSION ='2.7.6';

Is there any best practice regarding this issue? Is there a way to directly access the git tag name? Or should I go in a constant or composer.json way?

+5
source share
2 answers

You can try versioning-bundle . From your document:

  • Adds an additional parameter to the parameters.yml file and saves it embedded in your current version of the application.
  • Basic version handlers implemented for manual version control of git tags
+6
source

with this example you can now do everything:

  \Symfony\Component\VarDumper\VarDumper::dump(\Symfony\Component\HttpKernel\Kernel::VERSION); 

This is hardcoded const in symfony source.

You can:

  • enter your own const with this
  • to request this information
  • trigger or listener
  • etc.....
-2
source

Source: https://habr.com/ru/post/1241495/


All Articles