Download the PHP package codeuptime/app-version-laravel without Composer
On this page you can find all versions of the php package codeuptime/app-version-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codeuptime/app-version-laravel
More information about codeuptime/app-version-laravel
Files in codeuptime/app-version-laravel
Package app-version-laravel
Short Description Access your application version in Laravel
License MIT
Informations about the package app-version-laravel
app-version-laravel
This package makes it easy to access current app version information if your Laravel application at runtime.
This can be helpful when you want/need to:
- inlcude app version number in logs
- include app version in API responses
- show the current app version to your users
- ...
Pre-Requisites
This package relies on current version information being saved in the composer.json
or package.json
files under the version
key.
If you are not currently setting the version of your application in any of these files as part of your CI/CD workflows, you can follow this tutorial to get started: Automatic Version Tagging using Github Actions
Getting Started
Installation
Configre App Service Provider
The package should be included in your application automatically using Laravel's package auto-discovery functionality. If this does not work, you can always add the service provider manually to your config/app.php
Usage
You can now get your application version 2 ways:
Get current version
The current version logic checks the composer.json and package.json files for the version
key in that order. As soon as a version value is found, that value is returned.
Get composer.json version
Get package.json version
Get version information from all files
this one returns a \stdClass object containing all version information
Artisan Commands
There are cases where you would like to use the application version number in your scripts and automated workflows. This package provides two commands
version
This command just returns the current version string. This makes it very usable as part of your CI/CD scripts or adding this version to other build artifacts such as API docs.
version:info
This command is helpful when evaluating automation or debugging
version:set-in-json-file --file=/path/to/some/file.json --path=path.to.some.key.in.json.object
This command sets the current version number to a key in a json file. This can be in automated CI/CD pipelines that publish OpenAPI or Swagger based documentation and you want to include the application version with your documentation bundle.