PHP code example of davispeixoto / featuretoggle

1. Go to this page and download the library: Download davispeixoto/featuretoggle 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/ */

    

davispeixoto / featuretoggle example snippets


return [
    'my_feature' => true,
    'my_other_feature' => [
        'pt_br' => true,
        'en_us' => true,
        'es_es' => false
    ],
    ...
];

    Davispeixoto\FeatureToggler\FeatureToggler;
    ...

    $toggler = new FeatureToggler('path/to/my_config_file.php');

    if($toggler->isEnabled('my_feature')) {
        // do the feature here
    }

    ...
    // for multidimensional config array
    if($toggler->isEnabled('my_other_feature.en_us')) {
        // new code here
    } else {
        // old code here
    }
sh
php composer.phar update