Repository navigation
Releases
Releases · poli-page/laravel
v0.15.0
v0.13.1
Added
retries.max_retries(envPOLI_PAGE_RETRY_MAX_RETRIES): the number of retries after the first attempt (0 to 10), passed to the SDK asmaxRetries.
Deprecated
retries.max_attempts(envPOLI_PAGE_RETRY_MAX_ATTEMPTS) is renamedretries.max_retries. It never counted attempts: it was the SDK'smaxRetries, so3made up to 4 attempts. The old key keeps its meaning and works, with anE_USER_DEPRECATEDnotice; setting both keys to different values throwsInvalidArgumentException.
v0.13.0
First release on Packagist. It requires poli-page/sdk 0.13 and passes the Poli Page API contract v0.13.0. The package shares its major.minor with the Poli Page API, so its first version is 0.13.0; a 0.11.0 was prepared and never published, and neither was the 0.1.0 development line. The Changed, Removed and Fixed entries below describe changes made during those lines.
Added
PoliPageServiceProviderwith singleton container binding, config validation, publishableconfig/poli-page.php.PoliPageFacade exposingrender()/documents()methods over the SDK's readonly properties.PoliPageResponseFactorywithbytes/stream/preview/documentRedirectbuilders (correct PDF/HTML headers, RFC 5987 filename encoding,Cache-Control: private, no-store).php artisan poli-page:rendercommand for end-to-end smoke testing.- Laravel event bridges for the SDK's
onRetry/onErrorClosure hooks (PoliPageRetrying,PoliPageErrored). - Package auto-discovery via
composer.jsonextra.laravel. - Example Laravel 13 app at
example-app/with interactive single-page demo UI atGET /covering the SDK demo steps. - Error handler, on by default: an uncaught
PoliPageExceptionanswers itstoPayload()body,{ "code", "message", "status", "requestId" }, asapplication/jsonwith the payload's status (503fornetwork_error,504fortimeout,502forinvalid_response,500when the SDK knows no status, as forinvalid_optionsandio_error). Turn it off withPOLI_PAGE_ERROR_HANDLER=falseor'error_handler' => falseinconfig/poli-page.php. - Contract tests: CI runs the integration cases of the Poli Page API contract v0.13.0 (
poli-page/api-contract), includingimpl.invalid-response, against the example app on every matrix leg, and builds the example app. - Dependabot for Composer (the package and the example app) and GitHub Actions; the API contract has its own group and no cooldown.
- Release workflow: the tag's major.minor must be the pinned API contract's (a stable contract tag on the pinned commit, not the comment next to it) and the required
poli-page/sdk's (scripts/check-release-versions.sh); the error names both versions.
Changed
- Requires
poli-page/sdk^0.13.0(>=0.13.0 <0.14). With it, a 2xx from the API whose body is not JSON (usually from a proxy) raisesInvalidResponseException, codeinvalid_response(wasINTERNAL_ERROR), which the error handler answers502; arenderToFile()that cannot write its file raisesio_error(wasinvalid_options), answered500with"status": null; and the PDF download is bounded by thetimeoutoption (an idle timeout forpdfStream()). - The live API CI job passes the optional
POLI_PAGE_BASE_URLsecret to the integration test (unset: the SDK default), next to thepp_sandbox_key inPOLI_PAGE_API_KEY. The integration test setspoli-page.base_urlfromPOLI_PAGE_BASE_URLwhen it is set. - CI: the live API job runs on
main(and on demand) against the production API with the sandbox key from thePOLI_PAGE_API_KEYsecret, and skips with a notice when the key is absent or not app_sandbox_key. - API keys follow the environments format
pp_{environment}_{32 lowercase hex}(pp_sandbox_…,pp_live_…,pp_staging_…). The service provider no longer rejects keys outside the old test/live prefixes: it still throws on a missing or emptyapi_key, and logs one warning through Laravel's logger (without the key) when the key does not match the SDK's full-key regex, then lets the API decide. - Renders follow the SDK's environment keys and have no template versions: they take a
RenderInputwith noversion; the key's environment selects the published copy of the project. PoliPageResponseFactory::preview()takes aDocumentPreviewResultonly (the stored HTML of a rendered document).- Example app: the routes follow the SDK demo contract and lose their
/apiprefix:GET /render/pdf,GET /documents/{id}(a302to the presigned PDF URL),GET /errors/not-foundand the others. The error-handling demoGET /errors/not-foundrendersgetting-startedwith templatedoes-not-existand lets the package's error handler answer404with codeTEMPLATE_NOT_FOUND. Demo steps are renumbered 1–9. - Example app: reads
POLI_PAGE_API_KEYfrom the environment orexample-app/.env. - The integration test runs only with a
pp_sandbox_key. - Supported versions are now Laravel 12.x (Orchestra Testbench 10) and Laravel 13.x (Orchestra Testbench 11) on PHP 8.3–8.5. Laravel 10.x and 11.x are dropped: every release of both is flagged by Packagist security advisories, so Composer refuses to install them. Dev tooling moves to PHPUnit 11.5/12.5, PHPStan 2 and Larastan 3.
Removed
php artisan poli-page:render: the--template-version,--previewand--htmloptions. The command renders a PDF from--projectand--template.- Example app:
GET /api/render/previewand its dashboard button, andGET /api/errors/bad-version.
Fixed
PoliPageResponseFactory::stream()reads the first chunk before it returns, so a download that fails on its first read (DOWNLOAD_FAILED,network_error) reaches the error handler and answers its JSON payload, instead of a200with PDF headers and no body.- Example app:
bootstrap/cacheandstorage/framework/viewsare in the repository, sophp artisanand the demo page work in a fresh clone. PoliPageResponseFactory::bytes()/stream(): control characters (CR/LF, TAB, DEL, C1) are now stripped from theContent-Dispositionfilename instead of surviving as?in the fallback and%0D%0Ainfilename*. Filenames containing/,\or%no longer throwInvalidArgumentExceptionfromHeaderUtils::makeDisposition()(a 500): path separators become_, and%becomes?in the ASCII fallback only. The fallback now has one?per non-ASCII character (was one per UTF-8 byte), and a filename made only of control characters falls back todocument.pdf.- A key ending in a newline now logs the malformed-key warning (the format check is anchored with
\z, not$). php artisan poli-page:renderno longer prints the configured API key in its error output. A key ending in a newline made PSR-7 reject theAuthorizationheader with the wholeBearer <key>value in the exception message, which the command printed as is. Guzzle trims spaces and tabs from the value first, so the trimmed key is redacted too.