PHP code example of em411 / sylius-feature-flag-bundle-plugin

1. Go to this page and download the library: Download em411/sylius-feature-flag-bundle-plugin 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/ */

    

em411 / sylius-feature-flag-bundle-plugin example snippets


// config/bundles.php
return [
    // ...
    Ajgarlag\FeatureFlagBundle\FeatureFlagBundle::class => ['all' => true],
    Em411\SyliusFeatureFlagPlugin\Em411SyliusFeatureFlagPlugin::class => ['all' => true],
];

$featureChecker->isEnabled('my_flag');   // plain on/off flags
$featureChecker->getValue('my_flag');    // value-carrying flags

$allowed = $featureChecker->getValue('beta_checkout');        // "wholesale,vip" or false
$groups  = false === $allowed ? [] : explode(',', $allowed);
$enabled = \in_array($customer->getGroup()->getCode(), $groups, true);