Skip to content

Krisell/deployed-version-laravel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deployed Version Laravel

This package helps with determining which version of your app is currently running. This is useful during a deploy, to see when it is finished, and also when you rollback to ensure that the correct version is loaded.

Installation

Add the package to your Laravel project.

composer require krisell/deployed-version-laravel

The package is configured for automatic discovery, so unless you have other settings, you do not need to manually add the service provider.

Usage

The package by default adds a route /version which displays the value of the environment-variable VERSION.

You need to set the value of this variable during your build or deploy process.

VERSION=YOUR_VERSION_VALUE

One way to achieve this is to run the following script, which uses the git hash as the version number, but you may do it however you like:

echo "VERSION=$(git -C gitdir rev-parse HEAD)" >> .env.current-build

.env.current-build refers to a copy of the .env-file, to ensure that the addition is not persistent.

The route can be customized by setting an optional prefix,

VERSION_ROUTE_PREFIX=custom-prefix

Which makes the route /custom-prefix/version.

The route returns simple JSON data,

{
  "version": "version-number"
}

Licence

MIT

Author

Martin Krisell ([email protected])

About

Adds a route to show currently running version

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages