PHP code example of open-feature / cloudbees-provider
1. Go to this page and download the library: Download open-feature/cloudbees-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/ */
open-feature / cloudbees-provider example snippets
// retrieve the OpenFeatureAPI instance
$api = OpenFeatureAPI::getInstance();
// setup the CloudBeesProvider with the default settings
$provider = CloudBeesProvider::setup($apiKey);
// set the OpenFeature provider
$api->setProvider($provider);
// retrieve an OpenFeatureClient
$client = $api->getClient('cloudbees-example', '1.0');
$flagValue = $client->getBooleanDetails('dev.openfeature.example_flag', true, null, null);
// ... do work with the $flagValue
// IMPORTANT! make sure to shutdown the CloudBees provider
CloudBeesProvider::shutdown();