PHP code example of vestd / feature-flags

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

    

vestd / feature-flags example snippets


'providers' => [
    Vestd\FeatureFlags\FeatureFlagServiceProvider::class
];

public function index(FeatureCollection $featureCollection)
{
    $feature = $featureCollection->get('new_home_page');

    if ($feature->isEnabled()) {
        view('new_homepage');
    } else {
        view('homepage');
    }
}

  'feature_a' => true,
  'feature_b' => false,


  'feature_c' => [
    'users'  => [123, 456],
    'groups' => ['admin', 'beta'],
  ]


public function index(FeatureFlags $featureFlags)
{
    $feature = $featureFlags->get('new_home_page');

    if ($feature->isEnabledForUser(456) || $feature->isEnabledForGroup('admin')) {
        view('new_homepage');
    } else {
        view('homepage');
    }
}
bash
php artisan vendor:publish --provider="Vestd\FeatureFlags\FeatureFlagServiceProvider"