Define features, and check if they are activated or not in your php application. Integrates well with Symfony2 bundle lwiesel/FeatureCheckerBundle.
Via Composer
$ composer require lwiesel/feature-checker
$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
$ bin/phpspec run
Please see CONTRIBUTING for details.
Please see CHANGELOG for details.
If you discover any security related issues, please email wiesel.laurent@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.