PHP code example of harness / ff-server-sdk

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

    

harness / ff-server-sdk example snippets




arness\Client;
use OpenAPI\Client\Model\Target;

$SDK_KEY = getenv("SDK_KEY") ?: "";  // you can put your key in env variable or you can provide in the code
$FLAG_NAME = "harnessappdemodarkmode";

$client = new Client($SDK_KEY, new Target(["name" => "harness", "identifier" => "harness"]));
$result = $client->evaluate($FLAG_NAME, false);

echo "Evaluation value for flag '".$FLAG_NAME."' with target 'harness': ".json_encode($result);

http://localhost/online_example.php