Download the PHP package jackmartin/version without Composer
On this page you can find all versions of the php package jackmartin/version. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jackmartin/version
More information about jackmartin/version
Files in jackmartin/version
Package version
Short Description Take control over your Laravel app version
License MIT
Informations about the package version
Version
Take control over your Laravel app version
Description
This package is a Laravel (5.5+) utility which helps you keep and manage your application version, increment version numbers (major, minor, patch, build), and can also use your last commit hash as build number.
The end results of this package are:
- Print a version on a page.
- Print it in the console, via an Artisan command.
Some use cases for those results could be:
- Make sure a rollback was successful.
- Know if an update reached all servers.
- Check if a user is looking at the last version of your app.
- Verify if is Travis CI testing the version it is supposed to be testing.
- You simple love to version your stuff, and you like to see them in all your pages? That's cool too. :)
- What's your use case? Tell us!
Features
Easily control you app version using a YAML config file
Use your git commit as your app build number
Configure it
And you may have an output like this
Or just use an incremental build number:
To get
Easily increment your version numbers, using Artisan commands
Which should print the new version number
Available for all of them:
The output format is highly configurable
You can configure the :
Those are the results for full
and compact
formats
It gives you access to dynamic methods:
And should you create a new one:
It will also become callable:
A Facade is available
Instantiating it
If you prefer not to use the Façade:
The best ways to instantiate it are:
A simple PHP object instantiation:
Or to get an already instantiated Version object from the container:
But you have to make sure you published the config file
A Blade directive is also ready to be used in your views
You can use this directive to render a full version format:
Or choose the format:
You can configure the directive name:
Then
Git tags
You can use your git tags as application versions, all you need is to set the version source to "git":
And if you add a build number to your tags:
Version will use it as your app build number
Matching other version (git tags) formats
You probably only need to change the git version matcher
So let's say you tag your releases as
You can change your matcher to
And remove dots from your formats:
Using the current application version in your code
Here's a community example on how to send the app version number when logging an exception to Bugsnag:
Artisan commands
Those are the commands you have at your disposal:
version:show
Show the current app version:
version:(major|minor|patch|build)
Increment the version item:
version:refresh
Clear cache and refresh versions
version:absorb
This requires that you use annotated tags.
Version can absorb git version and build to the config file, so you can delete the .git folder and still keep your version and build cached for fast access. You have to configure git_absorb
in your config file:
And run it
The usual configuration setup to implement absorb is:
Install
Via Composer
Then publish the configuration file you'll have to:
And you should be good to use it in your views:
As git versions are cached, you can tell composer to refresh your version numbers every time an update or install occur, by adding the refresh command to post-autoload-dump
:
[Optional] You may also can automated this process by set inside your .git/hooks/post-commit
. It will automatic run the command once you have make a commit.
If you are using Git commits on your build numbers, you may have to add the git repository to your .env file
If you are using git-local
make sure the current folder is a git repository
Minimum requirements
- Laravel 5.5
- PHP 7.0
Testing
Troubleshooting
- If you are having trouble to install because of symfony/router (3.3/3.4) or symfony/yaml (3.3/3.4), you can try to:
License
This package is licensed under the MIT License - see the LICENSE
file for details
Contributing
Pull requests and issues are welcome.
All versions of version with dependencies
laravel/framework Version >=7.0
pragmarx/yaml Version ^0.3
symfony/process Version >=5.0