OpenFeature
This SDK ships a CNCF OpenFeature provider: Shipeasy\OpenFeature\ShipeasyProvider. If your app is standardized on the OpenFeature API, plug Shipeasy in as…
Generated from the SDK's own /docs/ — also served raw at
https://shipeasy-ai.github.io/sdk-php/pages/openfeature.md.
This SDK ships a CNCF OpenFeature provider:
Shipeasy\OpenFeature\ShipeasyProvider. If your app is standardized on the
OpenFeature API, plug Shipeasy in as the backing provider — evaluation is
unchanged.
open-feature/sdk (^2.0) is an optional dependency; install it in your app:
composer require open-feature/sdkWiring
Call Shipeasy\configure() first, then construct new ShipeasyProvider() with
no argument — the global form resolves the SDK that configure() set up:
use OpenFeature\OpenFeatureAPI;
use Shipeasy\OpenFeature\ShipeasyProvider;
use function Shipeasy\configure;
configure($_ENV['SHIPEASY_SERVER_KEY']); // once, at startup
$api = OpenFeatureAPI::getInstance();
$api->setProvider(new ShipeasyProvider()); // no-arg global form
$of = $api->getClient();
$on = $of->getBooleanValue('new_checkout', false, $ctx); // boolConstructing new ShipeasyProvider() before configure() throws
RuntimeException.
Type routing
- Booleans evaluate gates (
getFlag). - Strings / integers / floats / objects route to dynamic configs (
getConfig). - The evaluation context's targeting key becomes the
user_id; its attributes are carried through for targeting.
Reason / error mapping
Shipeasy reasons map onto OpenFeature's Reason / ErrorCode:
| Shipeasy | OpenFeature |
|---|---|
RULE_MATCH | TARGETING_MATCH |
DEFAULT | DEFAULT |
OFF | DISABLED |
OVERRIDE | STATIC |
| missing flag | FLAG_NOT_FOUND |
| uninitialized client | PROVIDER_NOT_READY |
| wrong config type | TYPE_MISMATCH |
Testing
In unit tests you want deterministic flag/config/experiment values with no network and no API key. Configure test mode once, then read through the bound…
Advanced
The PHP server is stateless and never auto-logs experiment exposures. To get exposure parity with the browser, call logExposure() on the bound Client at the…