Install the SDK
Use PHP 8.5 with thecurl extension. The built-in Guzzle HTTP client requires libcurl 8.3.0 or later.
Packagist provides the dev-main branch. Install it in the application that calls the exchanger.
composer.lock so subsequent installs use the same SDK revision. With Composer’s default stability setting, installing without a branch requires a stable release. PHP SDK on Packagist
Send a public ping
Save the example aspublic-ping.php in your project root. Replace https://your-exchange with your installation’s HTTPS origin, for example by setting EXCHANGER_API_ORIGIN. Use the scheme, host, and optional port. The SDK adds the /api/v3 path.
public-ping.php
php public-ping.php. Expect HTTP 200 and an ok status. Public ping
Verify your token and signature with a private ping
Create an API key on a test installation. Load the issued token and secret for the same key from your secret store into the process environment. Pass the token as issued. The SDK constructs theAuthorization: Bearer … header. A valid key and signature are sufficient for privatePing().
Save the example as private-ping.php next to the public one and run php private-ping.php.
Configure timeouts and diagnostics
- Set the response language with
Config(locale: ...)and override it for one call withRequestOptions(locale: ...). Available languages depend on the installation. - The built-in Guzzle client uses
connectTimeoutSecondsfor the connection andtimeoutSecondsfor the whole request. They default to 5 and 30 seconds. For a test server on loopback, explicitly enableallowInsecureLoopback: true. - When using your own PSR-18 transport, configure its timeouts, preserve the signed request bytes, and disable automatic redirects and retries.
- Use pagination for lists.
maxResponseBytesandmaxResponseTokensbound the size and complexity of the response. They default to 2 MiB and 50,000 JSON structural tokens.
Handle errors and retries
The exception classes are in theIEXExchanger\Sdk\Api\Exception namespace.
The built-in transport leaves retry decisions to your application. For diagnostics, record the HTTP status,
requestId, and correlationId from metadata. For 401, check your token, secret, and clock. For 429 or 503, follow the API delay and rate-limit rules. API errors
Before creating an order, save the operation key and the exact JSON string from CreateOrderRequest::toJson(). If you lose the response, look up the order first when you already have its ID. If the operation can be retried, pass the same data and key to orders()->create($savedJson, $savedKey). The SDK generates a fresh signature. metadata->idempotencyReplayed reflects the Idempotency-Replayed header. Retention and recovery conditions depend on the operation. Idempotency