- How do I install gotenberg/gotenberg-php in a Laravel application?
- Install it with composer require gotenberg/gotenberg-php. The package has no Laravel service provider, so bind your configured PSR-18 HTTP client and Gotenberg API URL in a small service class or custom facade. Then call the static Gotenberg builders from your controllers, jobs, or services.
- Does gotenberg/gotenberg-php work with Laravel and which Laravel versions are supported?
- It is a framework-agnostic PHP client, so it works in any Laravel version that can install it via Composer and provide a PSR-18 HTTP client. There is no Laravel-specific service provider; you wire it into Laravel's container yourself. Check the package composer constraints for the exact PHP and PSR dependency versions.
- Can I convert HTML to PDF in Laravel with this package?
- Yes. Use the Chromium builder, for example Gotenberg::chromium($apiUrl)->pdf()->url($url) for a URL or the HTML file methods for local markup. Send the request with a PSR-18 client and save the returned PDF stream with Laravel Storage. This keeps Chromium rendering inside the Gotenberg service rather than your Laravel workers.
- Can it convert Word, Excel, or Markdown files to PDF?
- Yes. The LibreOffice module handles office formats such as Word and Excel, and Gotenberg can also convert Markdown and other supported inputs depending on the endpoint you call. Build the request with Gotenberg::libreoffice($apiUrl) and the appropriate conversion methods, then stream the PDF response to storage. Version compatibility matters because supported formats and options follow the Gotenberg 8.x API.
- How do I generate PDFs asynchronously with Laravel queues and Gotenberg webhooks?
- Use Gotenberg webhooks for asynchronous processing: add your Laravel callback URL to the request, dispatch a job that sends the conversion request, and return immediately. The callback route receives Gotenberg's result and can store the PDF or update a database record for auditing. For simpler flows, queue a job that performs a synchronous conversion and handles retries around the API call.
- Do I need Docker or a separate Gotenberg server to use this package?
- Yes, the client needs a reachable Gotenberg API, and the standard deployment is the official Docker image. Chromium and LibreOffice run inside that service, so your Laravel host does not need those binaries installed. Plan for container orchestration, scaling, and health checks for the Gotenberg service in production.
- How can I test Gotenberg conversions without calling a real Gotenberg instance?
- Unit test your request-building code by injecting a mock PSR-18 client or a fake HTTP handler and asserting the request method, endpoint, and multipart body. Keep a small integration test suite that runs against a local Gotenberg container for real conversion behavior. In Laravel, bind the mock client in the container so jobs and services resolve the fake during tests.
- Does gotenberg/gotenberg-php support tagged PDFs for accessibility compliance?
- Yes, v2.26.0 added the generateTaggedPdf method for LibreOffice conversions, producing structure-tagged, accessibility-ready PDF output. That feature requires Gotenberg 8.38.0 or later, so pin the Gotenberg image tag and gate the option behind a config check. Validate tagged output with your PDF/UA, Section 508, or WCAG QA process before relying on it for compliance.
- How does the package handle HTTP clients and PSR-18 compatibility?
- It uses PSR-7 HTTP messages and a PSR-18 HTTP client, so you can pass Guzzle or another compatible client. The fluent builders create the request, and you send it through the client you provide. In Laravel, resolve that client from the service container and wrap configuration in a dedicated service class.
- Which Gotenberg version works with gotenberg/gotenberg-php v2, and how do I avoid version skew?
- Client v2.x targets Gotenberg 8.x; older Gotenberg 7.x uses client v1.x and Gotenberg 6.x uses thecodingmachine/gotenberg-php-client. Pin both the Composer package and the Gotenberg container image tag in your deployment configuration. Test against a staging Gotenberg instance before upgrading, especially for new features such as tagged PDFs that require a minimum server version.