向用户显示Symfony应用程序版本的最佳实践? [英] Best practice to display the version of a Symfony application to the user?

查看:103
本文介绍了向用户显示Symfony应用程序版本的最佳实践?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在Symfony2框架之上构建了一个Web应用程序构建.

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

现在,我们需要在前端显示我们软件的当前版本,以供用户查看.当前版本号是git存储库中的标记.

Now we need to display the current version of our software in the front end for the user to see. The version number is currently a tag in the git repository.

现在认为实现此目标的最佳做法是什么? Composer文档不鼓励使用composer.json

Now what is considered best practice to achieve this? The Composer documentation discourages the use of the version field used in the composer.json

Symfony本身似乎在app/bootstrap.php.cache文件中设置了版本字符串: const VERSION ='2.7.6';

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

关于此问题是否有最佳实践?有没有一种方法可以直接访问git标签名称?还是应该采用常数或composer.json的方式?

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

推荐答案

您可以尝试 versioning-bundle .根据他们的文档:

You could try versioning-bundle. From their doc:

  • 将其他参数添加到您的parameter.yml文件中并保留它 内联到您当前的应用程序版本.
  • 基本版本处理程序 实现了手动和git标签版本控制
  • Adds additional parameter to your parameters.yml file and keeps it inline with your current application version.
  • Basic Version handlers implemented for manual and git tag versioning

这篇关于向用户显示Symfony应用程序版本的最佳实践?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆