PHP code example of splitsoftware / split-sdk-php
1. Go to this page and download the library: Download splitsoftware/split-sdk-php 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/ */
splitsoftware / split-sdk-php example snippets
$sdkConfig = ['cache' => ['adapter' => 'predis']];
$splitFactory = \SplitIO\Sdk::factory('YOUR_SDK_KEY', $sdkConfig);
$splitClient = $splitFactory->client();
$treatment = $splitClient->getTreatment('CUSTOMER_ID','FEATURE_FLAG_NAME');
if ($treatment === 'on') {
// Feature is enabled for this user!
} elseif ($treatment === 'off') {
// Feature is disabled for this user!
} else {
// Unable to perform evaluation.
}