1. Go to this page and download the library: Download fetzi/flipt-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/ */
fetzi / flipt-php example snippets
$flipt = Flipt::create('http://localhost:8080');
$evaluateRequest = new EvaluateRequest('sample-flag', 'user-id', ['foo' => 'bar']);
$evaluateResponse = $flipt->evaluate($evaluateRequest);
if ($evaluateResponse->isMatch()) {
// awesome new feature
} else {
// old boring feature
}
$evaluateRequest = new EvaluateRequest('sample-flag', 'user-id', ['foo' => 'bar']);
$evaluateResponse = $flipt->evaluate($evaluateRequest);
if ($evaluateResponse->isMatch()) {
switch ($evaluateResponse->getVariant()) {
case 'a':
// show A variant
break;
case 'b':
// show B variant
break;
}
}
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.