PHP code example of monkeyscloud / monkeyslegion-feature-flags

1. Go to this page and download the library: Download monkeyscloud/monkeyslegion-feature-flags 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/ */

    

monkeyscloud / monkeyslegion-feature-flags example snippets


use MonkeysLegion\FeatureFlags\Feature;

// Define flags
Feature::defineBool('new-ui', false);
Feature::definePercentage('beta-access', 25);
Feature::defineAB('button-color', ['red' => 70, 'blue' => 30]);

// Check flags
if (Feature::isActive('new-ui')) { /* ... */ }
if (Feature::for($user)->isActive('beta-access')) { /* ... */ }
$variant = Feature::value('button-color', $user);