frostiede / silex-version-serviceprovider
Installs: 488
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/frostiede/silex-version-serviceprovider
Requires
- php: >=5.5
- pimple/pimple: ^3.0
Requires (Dev)
- phpunit/phpunit: ^5.6
This package is auto-updated.
Last update: 2025-09-16 21:25:09 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