I used to specify the app version inside composer.json
until I read somewhere here in Stack Overflow that it was a bad practice. What is the standard file to specifying the app version on a PHP Laravel application? (i.e: in .NET that'd be the config file, on iOS it'd be the info.plist, on Android it'd be the Manifest, etc...)
Every Laravel release has the version of the framework as constant in the Application. php file. You can access this constant via the app() helper. If you don't want to create a /test route to get the version, you can use php artisan tinker to get into the tinker REPL and run it from there.
change laravel/framework value inside composer. json to the new version (e.g. 6.18) run composer update.
Version Control for Laravel is a package that provides database version control for Eloquent models. This package works by creating a separate *_versions database table that corresponds with the model (i.e., users_versions ).
All of the configuration files for the Laravel framework are stored in the app/config directory. Each option in every file is documented, so feel free to look through the files and get familiar with the options available to you.
config/app.php
is definitely the place for such information.
Why ? Because the configuration files are (or should be) included in your versioning flow and they (should) contain non-sensitive information about your application. The perfect place for a simple version indicator.
under the name
index of the array, you could set a version
index like this
/*
|--------------------------------------------------------------------------
| Application Version
|--------------------------------------------------------------------------
|
| This value is the version of your application. This value is used when
| the framework needs to place the application's version in a notification
| or any other location as required by the application or its packages.
*/
'version' => '1.0.0',
@delatbabel
has a great start for version
config/app.php
'version' => env('APP_VERSION', '1.0.0'),
for config/bugsnag:
'app_version' => env('APP_VERSION', '1.0.0'),
then you can simply get your version with:
config('app.version')
now in docker you could set a default version on build:
ENV APP_VERSION=1.0.0
for example with circle CI you can add your build number:
ARG BUILD_NR
ENV APP_VERSION=1.0.$BUILD_NR
Now in your config.yml, you can add following job commando:
deliver-prod:
machine: true
steps:
- checkout
- docker build --build-arg BUILD_NR=$CIRCLE_BUILD_NUM .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With