Repository navigation
Releases
Releases · poli-page/symfony
v0.15.0
v0.13.1
Added
retries.max_retries: the number of retries after the first attempt (0 to 10), passed to the SDK asmaxRetries. The container parameter ispoli_page.retries.max_retries.- Symfony 8 support: every
symfony/*requirement now also accepts^8.0(PHP 8.4+). Symfony 6.4 and 7.x stay supported.
Deprecated
retries.max_attemptsis 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 a deprecation; setting both keys to different values throwsInvalidConfigurationException. The container parameter is nowpoli_page.retries.max_retries;poli_page.retries.max_attemptsis still set, to the same value, for apps that reference it.
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 bundle 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
- Modern
AbstractBundlewith full config tree covering everyPoliPageconstructor option. - Autowired
PoliPageclient (PSR-18 default:symfony/http-client; PSR-17 default:nyholm/psr7; PSR-3 default:logger). PoliPageResponseFactorywithbytes/stream/preview/documentRedirectbuilders.bin/console poli-page:rendercommand for end-to-end smoke testing.- Symfony EventDispatcher integration for the SDK's
onRetry/onErrorClosure hooks (PoliPageRetryEvent,PoliPageErrorEvent). - Symfony Flex recipe source in
recipes/, to be submitted tosymfony/recipes-contrib(until it is accepted, register the bundle by hand as the README shows). - Example Symfony 7 app at
example-app/covering the SDK demo steps. - 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 on the Symfony 7 legs. - Dependabot for Composer (the bundle 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. - Interactive demo UI at
GET /in the example app. Single-page editorial-style dashboard with one button per SDK feature, inline PDF/HTML previews via<iframe>, pretty-printed JSON for the documents and error endpoints, and copy-buttons for the CLI commands. No new dependencies (no Twig). Files:example-app/src/Controller/DemoController.php,example-app/templates/demo.html. composer servescript inexample-app/composer.json— runs PHP's built-in server on127.0.0.1:8000, removing the need for the optional Symfony CLI.tests/RestoresGlobalHandlers.phptrait — snapshots/restores global error/exception handler stack around kernel-booting tests.tests/bootstrap.php— replacesvendor/autoload.phpas PHPUnit's bootstrap; loads the repo-root.envso integration tests pick upPOLI_PAGE_API_KEYwithout a shell export.example-app/bootstrap.php— loads the repo-root.envbefore Symfony Runtime starts, so the example app uses the same key as the test suite. Deliberately does not requirevendor/autoload.php: Symfony Runtime must load it.
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 exception listener 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 setsbase_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. - The exception listener is on by default (
poli_page.exception_listener.enabled: true). An uncaughtPoliPageExceptionanswers 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). The body'sstatusis nownullwhen the SDK knows none; it used to repeat the500. Setexception_listener.enabled: falseto turn it off. The listener runs at priority-10, after FrameworkBundle logs the exception. - Example app:
GET /errors/not-foundlets the bundle's exception listener answer (404with thetoPayload()body) instead of catching the error itself. - Environment keys. An API key is
pp_{environment}_{32 hex}(pp_sandbox_…,pp_live_…,pp_staging_…). Theapi_keyconfig node no longer checks the key's format, so keys for any environment boot. When the client is built, a key that does not match the SDK contract's full-key pattern logs one warning throughpoli_page.loggerthat names the expected formatpp_{environment}_{32 lowercase hex characters}and shows no part of the key, not even itspp_{environment}_prefix; the API stays the only authority on keys. An empty key is still refused by the SDK. - Template versions are gone. Renders use the project's copy published in the key's environment:
poli-page:render, the example app, the README and the integration test build aRenderInputwith noversion. PoliPageResponseFactory::preview()takes aDocumentPreviewResultonly (the stored HTML of a rendered document).- The Flex recipe seeds
POLI_PAGE_API_KEY=pp_sandbox_replace_me. - The integration test runs only with a
pp_sandbox_…key (renders in other environments count toward the monthly quota). - Example app:
GET /errors/bad-versionis replaced byGET /errors/not-found, which rendersgetting-started/does-not-existand answers404with codeTEMPLATE_NOT_FOUND; the demo steps follow the SDK demo's numbering. composer.local.json, which pinned a local path to the SDK, is removed: the bundle requirespoli-page/sdkfrom Packagist.example-app/composer.json: removed dead Symfony Flexauto-scriptshooks. Composer no longer warns oncomposer install.example-app/.env: removed the placeholderPOLI_PAGE_API_KEYvalue. Value now comes from the repo-root.envviaexample-app/bootstrap.php. A comment in the file explains the override hierarchy.
Removed
poli-page:renderoptions--template-version,--previewand--html(HTML preview and inline-HTML rendering are gone from the API).- Example app:
GET /render/previewand its dashboard button.GET /documents/{id}/previewstays.
Fixed
- The exception listener decides per response whether output already started, instead of with the process-wide
headers_sent(). In a long-running worker (RoadRunner, FrankenPHP worker mode), output sent earlier in the process made every laterPoliPageExceptionanswer an empty500; it now answers its JSON payload. A streamed response whose callback throws, and (Symfony 7.1+) an error from akernel.terminatelistener, still get nothing appended. PoliPageResponseFactory::stream()no longer sendsContent-Length: -1when the download has no known length; it sets the header only when the size is>= 0.- An empty
base_url(for examplePOLI_PAGE_BASE_URL=) now means the SDK's default API URL. It was passed to the SDK as'', so every request went to a relative URL and failed asnetwork_error. - A download that fails after the streamed PDF's headers and first bytes went out no longer gets the listener's JSON appended to the PDF body: the listener adds nothing, so the client sees a truncated download, and the exception is still logged.
PoliPageResponseFactory::stream()reads the first chunk before it returns, so a download that fails on its first read (DOWNLOAD_FAILED,network_error) reaches the exception listener and answers its JSON payload, instead of a200with PDF headers and no body.- Example app: the controllers carry
#[AsController], so the routes work on Symfony before 7.3 (they answered 500, "cannot be fetched from the container because it is private"). The example app readsPOLI_PAGE_BASE_URLwith%env(default::POLI_PAGE_BASE_URL)%, so it no longer fails with "Environment variable not found" when the variable is unset; unset or empty means the SDK's default URL. - 8 PHPUnit "risky" warnings caused by Symfony's
FrameworkBundle::boot()leaking a global error handler past test boundaries. - A key ending in a newline now logs the malformed-key warning (the format check is anchored with
\z, not$). poli-page:renderno longer prints the configured API key. With older SDK releases, a key ending in a newline made the HTTP layer reject theAuthorizationheader with the wholeBearer <key>value in the error message. The command now replaces the key with[redacted API key], also with trailing spaces and tabs removed, the form Guzzle PSR-7 (a supportedrequest_factory) puts in its message.RenderCommandtakes the API key as a new constructor argument, which the bundle wires.composer installinexample-app/no longer errors with "non-existent script @auto-scripts" on PHP 8.5+.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.