PHP code example of flagr / sdk

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

    

flagr / sdk example snippets


use Flagr\FlagrClient;

$flagr = new FlagrClient(sdkKey: $_ENV['FLAGR_ENV_KEY']);

if ($flagr->isEnabled('new-checkout', tenantId: $userId)) {
    // show new checkout
}

$enabled = $flagr->isEnabled(
    flagKey:  'new-checkout',
    tenantId: $userId,   // optional, default "" — omit for flags that don't use partial rollout
    default:  false,     // returned if flag is unknown or request fails
);