PHP code example of lwiesel / feature-checker

1. Go to this page and download the library: Download lwiesel/feature-checker library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lwiesel / feature-checker example snippets


$checker->isFeatureEnabled('feature-set-C.feature-C1');// returns true

$checker->isFeatureEnabled('feature-set-C');// returns true
$checker->isFeatureEnabled('feature-set-D');// returns false
 php
$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
}