PHP code example of unleash / openfeature-provider

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

    

unleash / openfeature-provider example snippets


use OpenFeature\OpenFeatureAPI;
use Unleash\Client\UnleashBuilder;
use Unleash\OpenFeature\Provider\UnleashFlagProvider;

$builder = UnleashBuilder::create()
    ->withAppUrl('https://app.unleash-hosted.com/demo/api')
    ->withInstanceId('default:development.example-token')
    ->withAppName('my-php-app')
    ->withHeader('Authorization', 'default:development.example-token');

OpenFeatureAPI::getInstance()->setProvider(new UnleashFlagProvider($builder));