frostiede / silex-version-serviceprovider
v1.0.0
2016-10-16 13:29 UTC
Requires
- php: >=5.5
- pimple/pimple: ^3.0
Requires (Dev)
- phpunit/phpunit: ^5.6
This package is auto-updated.
Last update: 2024-11-16 19:14:05 UTC
README
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