PHP Server SDK Getting Started
Please follow the installation procedure and then run the following:
Initializing SDK
<?php
require_once(__DIR__ . '/vendor/autoload.php');
use DevCycle\DevCycleConfiguration;
use DevCycle\Api\DevCycleClient;
use DevCycle\Model\DevCycleOptions;
use DevCycle\Model\DevCycleUser;
// Configure API key authorization: bearerAuth
$config = DevCycleConfiguration::getDefaultConfiguration()->setApiKey(
"Authorization",
getenv("DEVCYCLE_SERVER_SDK_KEY")
);
$devcycleClient = new DevCycleClient(
$config,
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
);
$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;
}