Skip to content

Types

The PHP SDK exposes the types below. Import any of them with use:

use PoliPage\PoliPage;
use PoliPage\ProjectModeInput;
use PoliPage\DocumentDescriptor;

Poli Page SDK client — entry point for the namespaced render API.

The render namespace exposed as $client->render. Phases 2 + 3 cover the four render operations; Phase 4 adds Documents.

The documents namespace exposed as $client->documents. Hosts the four stored-document operations per spec v1.3 §6.

Sealed-in-package base for render inputs. The SDK exposes only two concrete subclasses (, ); external code cannot subclass this directly because the constructor is protected and both children are final.

Render against a stored project + template. Used by render->pdf, render->pdfStream, render->document, and render->preview.

Render with raw HTML inline (no project / template resolution). Accepted only by render->preview; the document-producing methods require project mode (enforced both at the type-hint level and at runtime).

Result of client->render->preview($input). Wire shape produced by POST /v1/render/preview — paginated HTML preview output. The totalPages field on this DTO is distinct from pageCount on (added in Phase 4) — see sdk-node 8523e13.

Stored document returned by $client->render->document(...). Mirrors the deployed API’s wire shape one-to-one. Nullable wire fields (project ids, template ids, version, etc.) map to ?string; metadata is always non-null (the server echoes {} when the caller omits it).

Result of $client->documents->preview($id). The deployed API responds with text/html directly (not a JSON envelope), exposing the page count via the X-Document-Page-Count response header.

A single page thumbnail returned by $client->documents->thumbnails(...). data is base64-encoded image bytes; decode with base64_decode before writing to disk or sending downstream. Spec §6.3.

Options for $client->documents->thumbnails($id, $options). Spec §6.3.

Free-form caller metadata forwarded to the API and echoed back on preview and document responses. Values are limited to primitives (string | int | float | bool) — nested arrays and objects are rejected at construction time to match the wire-contract guarantee (spec §5.4) and the Node SDK’s compile-time enforcement (types.ts:31).

Fired before each retry sleep — carries the upcoming attempt number, the sleep duration in milliseconds (spec convention is delayMs across all SDKs even though PHP internals use seconds), and the exception that caused the previous attempt to fail.

For the full set of fields on each class and the PoliPage\Exception\* hierarchy, see the source on GitHub.