PHP code example of devcycle / php-server-sdk

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

    

devcycle / php-server-sdk example snippets



DevCycle\Api\DevCycleClient;
use DevCycle\Model\DevCycleOptions;
use DevCycle\Model\DevCycleUser;

$options = new DevCycleOptions(
    false,
    $bucketingHostname,
    $unixSocketPath
);

$devCycleClient = new DevCycleClient(
    sdkKey: getenv("DEVCYCLE_SERVER_SDK_KEY"),
    dvcOptions: $options
);

$user_data = new DevCycleUser(array(
  "user_id"=>"my-user"
));

try {
    $result = $apiInstance->allFeatures($user_data);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DevCycleClient->allFeatures: ', $e->getMessage(), PHP_EOL;
}


$devCycleClient = new DevCycleClient(
    sdkKey: getenv("DEVCYCLE_SERVER_SDK_KEY"),
    dvcOptions: $options
);
$api->setProvider($devCycleClient->getOpenFeatureProvider());
json
{
  "cycle/php-server-sdk": "*"
  }
}