Skip to main content

PHP Server SDK Getting Started

Packagist GitHub

Please follow the installation procedure and then run the following:

Initializing SDK

require_once(__DIR__ . '/vendor/autoload.php');

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

$options = new DevCycleOptions();
$devCycleClient = new DevCycleClient(
sdkKey: getenv("DEVCYCLE_SERVER_SDK_KEY"),
dvcOptions: $options);
$user_data = new DevCycleUser(array(
"user_id"=>"my-user"
));

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

Initialization Options

The SDK exposes various initialization options which can be set when creating a new DevCycleClient:

$options = new DevCycleOptions();
$devCycleClient = new DevCycleClient(
sdkKey: getenv("DEVCYCLE_SERVER_SDK_KEY"),
dvcOptions: ($options);
$user_data = new DevCycleUser(array(
"user_id"=>"my-user"
));
DevCycle OptionTypeDescription
enableEdgeDBboolEnables the usage of EdgeDB for DevCycle that syncs User Data to DevCycle.
NOTE: This is only available with Cloud Bucketing.
bucketingApiHostnamestringContact support for usage instructions.
unixSocketPathstringContact DevCycle support for instructions on how to configure this option.
httpOptionsarrayContact DevCycle support for instructions on how to configure this option.