creacoon / laravel-app-versioning
A Laravel package for managing application versioning
Fund package maintenance!
creacoon
Requires
- php: ^8.3
- illuminate/contracts: ^10.0|^11.0|^12.0
- illuminate/support: ^10.0|^11.0|^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^10.0.0||^9.0.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- spatie/laravel-ray: ^1.35
README
A Laravel package for managing application versioning.
Installation
You can install the package via composer:
composer require Creacoon/laravel-app-versioning
After installing, publish the configuration file:
php artisan vendor:publish --provider="Creacoon\AppVersioning\VersionManagerServiceProvider" --tag="config"
Usage
Getting the current version
// Using the facade use Creacoon\AppVersioning\Facades\VersionManager; $version = VersionManager::getCurrentVersion(); // Using the command php artisan version
Setting a new version
// Using the facade use Creacoon\AppVersioning\Facades\VersionManager; VersionManager::setVersion('1.2.3'); // Using the command php artisan version 1.2.3
The package will:
- Update the version in your config file
- Update the runtime configuration
- Update your CHANGELOG.md file
- Create a git commit with the changes
- Create a git tag for the new version
Configuration
You can customize the package behavior by modifying the config/version.php
file:
return [ 'config_key' => 'app.version', 'version_key' => 'version', 'config_path' => config_path('app.php'), 'changelog_path' => base_path('CHANGELOG.md'), 'unreleased_pattern' => '## [Unreleased]', 'commit_message' => 'chg: dev: Version set to', 'files_to_commit' => [ 'CHANGELOG.md', 'config/app.php' ], ];
License
The MIT License (MIT). Please see License File for more information.