Configuration
The PoliPage constructor accepts named arguments. Every parameter is optional except apiKey. Defaults match the canonical SDK behavior shared by every Poli Page SDK.
Available options
Section titled “Available options”apiKey(required) — yourpp_test_orpp_live_key.baseUrl— override the API endpoint. Defaults tohttps://api.poli.page.timeout— per-request timeout in seconds. Defaults to60.0.maxRetries— maximum retry attempts for retryable errors. Defaults to2(three total attempts).retryDelay— initial retry backoff in seconds. Defaults to0.5. Doubles each attempt.httpClient— a PSR-18ClientInterface. If omitted, the SDK usesPsr18ClientDiscovery::find().requestFactory/streamFactory— PSR-17 factories. Auto-discovered when omitted.logger— any PSR-3LoggerInterface. Defaults to aNullLogger.onRetry/onError— observability hooks. Never block, never mutate requests.
Example
Section titled “Example”<?php
require __DIR__ . '/vendor/autoload.php';
use PoliPage\PoliPage;use Psr\Log\LoggerInterface;
$client = new PoliPage( apiKey: $_ENV['POLI_PAGE_API_KEY'], timeout: 30.0, maxRetries: 3, retryDelay: 0.25, onRetry: fn ($event) => error_log(sprintf('retry #%d in %.0fms', $event->attempt, $event->delayMs)), onError: fn ($error) => error_log(sprintf('terminal: %s', $error->errorCode)),);