Search by

misodrobny / application-versioning

misodrobny

Laravel package for application versioning in your application with ease.

Package info

github.com/misodrobny/application-versioning

pkg:composer/misodrobny/application-versioning

Fund package maintenance!

Michal Drobny

Statistics

Installs: 411

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 3

0.2.0 2026-10-16 18:17 UTC

This package is auto-updated.

Last update: 2026-10-16 18:18:03 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package will help to manage version of your application. It will create version.yaml file in root of your project and you can manage version of your application in this file.

For more about application versioning please follow Semantic Versioning

Installation

You can install the package via composer:

composer require misodrobny/application-versioning

After installation, you need to run install script which will publish config file and create default version.yaml file.

php artisan application-versioning:install

This is the contents of the published config file:

return [
    'version_file_path' => base_path('version.yaml'),
    'disk' => env('APP_VERSIONING_DISK'),
    'disk_path' => env('APP_VERSIONING_DISK_PATH', 'version.yaml'),
    'git_path' => env('APP_VERSIONING_GIT_PATH', base_path().'/.git'),
];

Initial formated version has following structure:

$major.$minor.$patch - $git_hash

$git_hash contains 7 characters long GIT HASH from current git commit. It is read from a checked out branch, from a ref stored only in packed-refs, and from a detached HEAD (a deployment that checks out a commit). When no hash can be read, $git_hash is empty instead of an exception being thrown.

Storage disk

By default version.yaml is a local file at version_file_path. To read and write it through a Laravel filesystem disk instead (for example when several servers share it), set the disk and the path on that disk:

APP_VERSIONING_DISK=s3
APP_VERSIONING_DISK_PATH=my-app/version.yaml

The install command, the increase command and all methods below then use that disk.

Usage

ApplicationVersioning is registered as a singleton. Resolve it from the container or use the facade ApplicationVersion instead of instantiating it.

For getting version of your application:

    echo ApplicationVersion::getFormatedVersion();

To increase version of your application you can use following methods:

    use DrobnyDev\ApplicationVersioning\ApplicationVersioning;

    app(ApplicationVersioning::class)->increaseMajor();
    app(ApplicationVersioning::class)->increaseMinor();
    app(ApplicationVersioning::class)->increasePatch();

It is also possible to run

php artisan application-version:increase 

This command will generate Laravel Prompt window for choosing which version needs update:

┌ Which version do you want to increase? ──────────────────────┐
│   ○ major                                                    │
│   ○ minor                                                    │
│ › ● patch                                                    │
└──────────────────────────────────────────────────────────────┘

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.