Releases: poli-page/sdk-php
Releases · poli-page/sdk-php
v0.9.0
The first public release. The API surface is complete but not yet frozen;
breaking changes may still land before 1.0.0.
Added
PoliPageclient — entry point for the render and documents
namespaces. Construct viaPoliPage::client($apiKey)for the
one-line ergonomic, or via the named-argument constructor for
full configuration (apiKey,baseUrl,maxRetries,
retryDelay,timeout,httpClient,requestFactory,
streamFactory,logger,onRetry,onError).- Render namespace —
$client->render:pdf(ProjectModeInput): string— render and return raw bytes.pdfStream(ProjectModeInput): StreamInterface— same aspdf
but returns a PSR-7 stream for memory-bounded piping to disk /
HTTP responses / S3.preview(RenderInput): PreviewResult— paginated HTML preview;
accepts both project mode and inline HTML.document(ProjectModeInput): DocumentDescriptor— render and
store; returns the descriptor withpresignedPdfUrland a
fluentdownloadPdf()helper.
- Documents namespace —
$client->documents:get($id): DocumentDescriptor— refresh a stored document's
presigned URL.preview($id): DocumentPreviewResult— paginated HTML +
pageCount(read from theX-Document-Page-Countresponse
header).thumbnails($id, ThumbnailOptions): list<Thumbnail>— generate
page thumbnails in PNG or JPEG.delete($id): void— soft-delete a stored document.
PoliPage\renderToFile($client, $input, $path): void— free
function, autoloaded via Composer's"files"entry. Streams
bytes to disk in 8 KB chunks.- Exception hierarchy under
PoliPage\Exception, all rooted in
PoliPageException:ConnectionException→TimeoutExceptionfor transport
failures.ApiStatusException→
BadRequestException/AuthenticationException/
PermissionDeniedException/NotFoundException/
GoneException/RateLimitException/
InternalServerExceptionfor the well-known statuses; any other
4xx falls through toApiStatusException.- Predicate helpers (
isAuthError,isRateLimitError,
isValidationError,isNetworkError,isRetryable) kept for
spec parity across SDK languages.
- Sealed input hierarchy:
RenderInput(abstract readonly base)
withProjectModeInputandInlineModeInputas the only
concrete subclasses; sealing enforced viafinalchildren plus
the project-mode-only constraint on the document-producing
methods. RenderMetadatawrapper with a primitives-only guard
(string|int|float|bool); rejects arrays / objects / null with
PoliPageException(INVALID_OPTIONS).- Retry policy ported byte-for-byte from the Node reference:
retries on 5xx + 429 + network + timeout, exponential backoff
with jitter in[0.5, 1.5], serverRetry-Afterhonoured
(capped at 30 s),maxRetriesdefaulting to 2. - Idempotency: every POST sends an auto-generated UUID v4
Idempotency-Key; override via theidempotencyKey:input
field. - PSR-3
LoggerInterfaceinjection for structured debug / retry /
error events; defaultNullLogger. Auth headers are never
logged. - PSR-18 + PSR-17 injection with auto-discovery via
php-http/discovery— pick any concrete HTTP client and PSR-7
implementation. - Runnable end-to-end demo at
examples/demo.phpexercising every
public method against the develop API.
Tooling
- PHPUnit 11 unit + integration suites; integration tests gated on
POLI_PAGE_API_KEYand theintegrationgroup. - PHPStan max +
phpstan-strict-rulesclean. - PHP-CS-Fixer (
@PSR12+declare_strict_types) clean. - CI matrix: PHP 8.3 / 8.4 / 8.5 on Ubuntu plus one job each on
macOS and Windows for 8.5.composer validate --strict,
composer audit, lint, static analysis, and unit tests all gated.