Where to specify an app version on a Laravel app?

I normally set it in my .env file and then pick that up in a config.

e.g. .env says:

APP_VERSION=2.1

config/app.php says:

'version' => env('APP_VERSION', '0.0.1-alpha'),

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

Docker

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 .