PHP
Configuration
Configure PHP authentication, retries, timeouts, and PSR-18 clients
Overview
Configuration is optional. The SDK's defaults are suitable for most integrations, so you only need this guide when you want fine-grained control over behavior such as retries, timeouts, and the underlying PSR-18 client.
use Insion\InsionClient;
$client = new InsionClient(
token: '<token>',
options: [
'maxRetries' => 2,
],
);Keep the API key on a trusted server. Never expose it in client applications, logs, or source control.
Supply a PSR-18 ClientInterface under client to control networking; discovery supplies the default. The default request timeout is 30 seconds and the retry limit is two.
Per-request options
$page = $client->listRecords(
new GetApiV1RecordsRequest(['limit' => 50]),
options: [
'timeout' => 10.0,
'maxRetries' => 0,
'headers' => ['X-Request-ID' => 'req-123'],
],
);Per-request settings override the client for that call.
How is this guide?