lwiesel / feature-checker
Enable and disable functional features in php application.
v1.1.2
2015-02-27 10:48 UTC
Requires
- php: >=5.3.0
Requires (Dev)
- henrikbjorn/phpspec-code-coverage: ~1.0
- phpspec/phpspec: ~2.1
- scrutinizer/ocular: ~1.1
This package is not auto-updated.
Last update: 2024-11-23 17:51:35 UTC
README
Define features, and check if they are activated or not in your php application. Integrates well with Symfony2 bundle lwiesel/FeatureCheckerBundle.
Install
Via Composer
$ composer require lwiesel/feature-checker
Usage
$features = array( 'feature-A' => true, 'feature-B' => false, 'feature-set-C' => array( 'feature-C1' => true, 'feature-C2' => true, ), 'feature-set-D' => array( 'feature-D1' => true, 'feature-set-D2' => array( 'feature-D2-a' => true, 'feature-D2-b' => false, ), ), ); $checker = new LWI\FeatureChecker($features); // ... if ($checker->isFeatureEnabled('feature-A')) { // Do something here }
Sub-features can be checked with this notation:
$checker->isFeatureEnabled('feature-set-C.feature-C1');// returns true
You can also test whole feature sets. A feature set is considered enabled when all sub-features -at any sub-level- is enabled.
$checker->isFeatureEnabled('feature-set-C');// returns true $checker->isFeatureEnabled('feature-set-D');// returns false
Testing
$ bin/phpspec run
Contributing
Please see CONTRIBUTING for details.
Changelog
Please see CHANGELOG for details.
Security
If you discover any security related issues, please email wiesel.laurent@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.