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;
}