senither/version-comparison

Compares current git commit SHA with a remotely tracked version to see if the application is outdated

1.2.0 2022-02-10 20:20 UTC

This package is auto-updated.

Last update: 2024-04-11 01:01:05 UTC


README

A Laravel package that compares the current git commit SHA with a remotely tracked version to see if the application is outdated, this is used in some of my projects to allow users to see when their instance of my software is out of date.

Note: The project relies on private version tracking software, it will not do anything without a tracking ID the system can use to compare commit SHAs.

Installation

You can install the package via composer:

composer require senither/version-comparison

You can publish the config file with:

php artisan vendor:publish --provider="Senither\VersionComparison\VersionComparisonServiceProvider" --tag="config"

This is the contents of the published config file:

return [

    /*
    |--------------------------------------------------------------------------
    | Version Tracking ID
    |--------------------------------------------------------------------------
    |
    | The unique ID for the project that the latest git commit SHA
    | should be compared with via the API, this can be found on
    | the version tracker when selecting the project.
    |
    | @url https://vt.senither.com/dashboard
    */

    'id' => env('VERSION_COMPARISON_ID', null),

    /*
    |--------------------------------------------------------------------------
    | Cache Expiration Times
    |--------------------------------------------------------------------------
    |
    | The amount of time in seconds that should elapse before
    | the current commit hash is refreshed, or the latest
    | version is fetched from the API.
    |
    */

    'cache_time' => [
        'version' => 7200,
        'commit_hash' => 3600,
    ],
];

Usage

use Senither\VersionComparison\Facades\Version;

// Gets the current version
Version::getCurrentVersion();

License

The Version Comparison package open-sourced software licensed under the MIT license.