Friday, March 18, 2022

[FIXED] Where to specify an app version on a Laravel app?

Issue

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...)


Solution

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',


Answered By - George Dimitriadis

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.