Shipeasy
ReferencePHP

Configuration

Shipeasy\configure() is the single setup call. The full reference — install, per-framework wiring, and the $opts table — lives on Installation. This page…

Generated from the SDK's own /docs/ — also served raw at https://shipeasy-ai.github.io/sdk-php/pages/configuration.md.

Shipeasy\configure() is the single setup call. The full reference — install, per-framework wiring, and the $opts table — lives on Installation. This page focuses on the options themselves.

Configure the SDK once at startup. It is first-config-wins — the first call sets up the SDK and fires the one-shot fetch; later calls are ignored.

use function Shipeasy\configure;

configure(
    $_ENV['SHIPEASY_SERVER_KEY'],   // the Shipeasy SERVER key (never the client key)
    fn ($u) => [                    // optional attributes transform (default: identity)
        'user_id' => $u->id,
        'plan'    => $u->plan,
    ],
    [                               // optional configure() options
        'env'                => 'prod',
        'baseUrl'            => 'https://edge.shipeasy.dev',
        'disableTelemetry'   => false,
        'telemetryUrl'       => null,
        'privateAttributes'  => ['email'],
        'stickyStore'        => null,
    ],
);

Arguments

ArgTypeNotes
$apiKeystringThe Shipeasy server key. Required.
$attributescallable|null(yourUser) => attributeMap. Default is identity — omit it when your user array already IS the Shipeasy attribute map. Runs once per new Client($user).
$optsarrayThe options below (all optional).

$opts keys

KeyDefaultMeaning
env'prod'The read environment for the blob.
baseUrlhttps://edge.shipeasy.devEdge API base.
disableTelemetryfalseOpt out of the usage-telemetry beacon.
telemetryUrl(built-in)Override the telemetry endpoint.
privateAttributes[]Attribute names stripped from outbound event payloads (LD/Statsig privateAttributes). See Advanced.
stickyStorenullA Shipeasy\StickyBucketStore for durable experiment bucketing. See Advanced.

The fetch model (no background poll)

configure() fetches the rule blob once per request the moment it runs, so new Client($user)->getFlag(...) resolves against real rules immediately — there is no separate init step and no poll option.

PHP is request-scoped and has no background poll thread:

  • PHP-FPM / classic request lifecycleconfigure() fetches once per request. Nothing else to do.
  • Long-running runtimes (Swoole, RoadRunner, queue/CLI workers) — a process serves many requests, so refresh the blob on a schedule to keep it fresh across requests.

Environment variables

The SDK does not read env vars itself — pass $_ENV['SHIPEASY_SERVER_KEY'] explicitly. Conventionally:

  • SHIPEASY_SERVER_KEY — the server key for configure().
  • The public client key (a separate value) is only used for the i18n loader <script> tag, never for server evaluation. See i18n.
Was this page helpful?
✎ Edit this page

On this page