frostiede/silex-version-serviceprovider

v1.0.0 2016-10-16 13:29 UTC

This package is auto-updated.

Last update: 2024-03-16 17:31:18 UTC


README

Build Status Code Climate

ServiceProvider for Silex which enables loading a version file to specify application version.

Installation

$ composer require frostiede/silex-version-serviceprovider

Afterwards, register the ServiceProvider:

$app->register(new VersionServiceProvider(), [
    'version.file' => __DIR__ . '/VERSION'
]);

Usage

You can now use $app['version'] to determine the current application version.

Configuration

You must specify the parameter version.file which holds the path to the VERSION file which is loaded.

Optional: if you want to add an suffix to the version (e.g. -dev), you can do that, too. Just specify the option version.suffix. Example:

$app->register(new VersionServiceProvider(), [
    'version.file' => __DIR__ . '/VERSION',
    'version.suffix' => $app['debug'] ? 'debug' : ''
]);

This adds the suffix debug in case Silex is in debug mode.

Contribution

Any help is welcomed. Feel free to create issues and merge requests :-)

License

MIT License