PHP code example of featuretoggle / lib-php

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

    

featuretoggle / lib-php example snippets




// Create a new FTClient with your customer and environment API key's
$featuretoggle = new FeatureToggle\FTClient('customerKey', 'environmentKey', array('options'));

// Get features
$features = $featuretoggle->getFeatures();

// Check feature status
$enabled = $featuretoggle->isEnabled('feature_key');
if($enabled) {
    // Feature is enabled, do something
}
else {
    // Feature is disabled, do something else
}

array(
    'cache_timeout' => SECONDS, // optional, defaults to 300 seconds
)
bash
php composer.phar