Shipeasy
ReferencePHP

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/sdk

Wiring

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);   // bool

Constructing 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:

ShipeasyOpenFeature
RULE_MATCHTARGETING_MATCH
DEFAULTDEFAULT
OFFDISABLED
OVERRIDESTATIC
missing flagFLAG_NOT_FOUND
uninitialized clientPROVIDER_NOT_READY
wrong config typeTYPE_MISMATCH
Was this page helpful?
✎ Edit this page

On this page