PHP code example of configcat / openfeature-provider

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

    

configcat / openfeature-provider example snippets


// Acquire an OpenFeature API instance.
$api = OpenFeatureAPI::getInstance();

// Build options for the ConfigCat SDK.
$options = [
  ClientOptions::LOG_LEVEL => LogLevel::WARNING,
  ClientOptions::CACHE_REFRESH_INTERVAL => 5,
  //...
];

// Configure the provider.
$api->setProvider(new ConfigCatProvider('<YOUR-CONFIGCAT-SDK-KEY>', $options));

// Create a client.
$client = $api->getClient();

// Evaluate a feature flag.
$isMyAwesomeFeatureEnabled = $client->getBooleanValue('isMyAwesomeFeatureEnabled', false);