Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Gotenberg Php

Gotenberg Php Laravel Package

gotenberg/gotenberg-php

PHP client for the Gotenberg API to convert documents to PDF using Chromium/LibreOffice. Build requests for URL, HTML, Markdown, and Office files, then stream or save outputs. Compatible with Gotenberg 8.x via client v2.x.

View on GitHub
Deep Wiki
Context7

🐘 A PHP client for interacting with Gotenberg.

Frequently asked questions about Gotenberg Php
How do I install gotenberg/gotenberg-php in a Laravel project?
Run `composer require gotenberg/gotenberg-php` in your project directory. The package requires PHP 8.1+ and Laravel 8.x or later. No additional Laravel service provider is needed, though you may wrap it in a custom facade for consistency.
What Laravel versions does this package support?
The package is compatible with Laravel 8.x, 9.x, and 10.x. It relies on PSR-18 HTTP clients (like Laravel’s built-in `HttpClient` facade), so it integrates natively with modern Laravel versions. Test thoroughly if using Laravel 7.x or earlier.
Can I use this package to convert Word or Excel files to PDF?
Yes, the package supports converting Office formats (DOCX, XLSX) to PDF via LibreOffice through the Gotenberg API. Use `Gotenberg::libreoffice()->pdf()->file($filePath)` to process local files or `Gotenberg::libreoffice()->pdf()->url($url)` for remote files.
How do I handle large file conversions without memory issues?
Stream responses directly to storage using `$response->getBody()` and avoid loading entire files into memory. For Laravel, use `Storage::disk()->put($filename, $response->getBody())` with chunked writes. Gotenberg also supports streaming for large inputs.
Is there built-in support for Laravel Queues or background jobs?
Yes, dispatch conversions as Laravel jobs using `ConvertDocumentJob::dispatch($input, $output)` with `delay()` for async processing. The package integrates with Laravel’s queue system, making it ideal for high-volume or long-running conversions.
What if the Gotenberg API is down or unresponsive?
Use Laravel’s retry helper (`retry()`) or implement circuit breakers (e.g., Predis for Redis) to handle API failures gracefully. Log errors with `Log::error()` and consider queue dead-lettering for failed jobs in production.
How do I authenticate with the Gotenberg API in Laravel?
Pass authentication tokens via the client: `Gotenberg::chromium($apiUrl)->auth('Bearer', $token)`. For mutual TLS, configure the Laravel `HttpClient` with SSL options before passing it to the client. Store credentials securely using Laravel’s `env()` or `config()`.
Can I use this package with serverless (e.g., AWS Lambda) or Kubernetes?
Yes, the package is microservice-friendly. Deploy Gotenberg in containers (Docker/K8s) or serverless (AWS Fargate/Lambda) and configure Laravel to call it via HTTP. Use environment variables for dynamic API URLs and scale Gotenberg independently.
Are there alternatives to this package for Laravel?
Alternatives include `thecodingmachine/gotenberg-php-client` (for Gotenberg 6.x) or Symfony’s `GotenbergBundle`. For self-hosted solutions, consider `dompdf/dompdf` (lightweight but limited) or `spipu/html2pdf` (HTML-focused). This package is preferred for modern Laravel apps needing Chromium/LibreOffice.
How do I test this package in a Laravel application?
Mock the Gotenberg API using Laravel’s `HttpClient` facade with fake responses in tests. Example: `$client->fake([$apiUrl => Http::response(file_get_contents('test.pdf'), 200)])`. Test edge cases like invalid URLs, timeouts, and large files with `Storage::fake()`.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
codifyo/ts-generator-bundle
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor