sensiolabs/gotenberg-bundle
Symfony bundle to generate PDFs and screenshots via the Gotenberg API. Convert from URL, HTML, Markdown, or Office files, then stream or save outputs locally. Supports source-specific options, advanced usage, and profiler/testing integrations.
Strengths:
UrlPdfBuilder, HtmlPdfBuilder, etc.), aligning with Laravel’s service-oriented architecture if adapted via Symfony’s bridge (e.g., Laravel Symfony Bridge).Gaps:
laravel-twig-bridge).gotenberg_asset() Twig function).Mockery or Pest).GotenbergPdfInterface to a Laravel service provider).laravel-twig-bridge to render Twig templates in Laravel, then pass HTML to the bundle’s builders.asset() with Laravel’s asset() helper or a custom resolver for the gotenberg_asset() Twig function.HttpClient or Guzzle instead of Symfony’s HttpClient (adapt the bundle’s http_client config).View system for HTML generation instead of Twig where possible.HttpClient, Twig) may conflict with Laravel’s versions. Mitigate via strict composer constraints or isolation (e.g., Docker).cache() or Redis).skipNetworkAlmostIdleEvent).Laravel Compatibility:
HttpClient with Laravel’s HttpClient or Guzzle via a custom adapter.laravel-twig-bridge to render Twig templates in Laravel. Modify the bundle’s gotenberg_asset() function to use Laravel’s asset() helper.$this->app->bind(GotenbergPdfInterface::class, function ($app) {
return new GotenbergPdf($app->make(HttpClient::class), $app->get('config')['gotenberg']);
});
GotenbergPdfInterface into controllers.Gotenberg Setup:
.env with:
GOTENBERG_DSN=http://gotenberg:3000
GOTENBERG_CHROMIUM_FLAGS="--disable-gpu --no-sandbox"
host.docker.internal to avoid SSL issues (see FAQ).Phase 1: Proof of Concept (1–2 weeks)
laravel-twig-bridge.Phase 2: Core Integration (2–3 weeks)
HttpClient with Laravel’s equivalent.gotenberg_asset().Cache::remember) for generated outputs.Phase 3: Advanced Features (1–2 weeks)
Phase 4: Deployment (1 week)
gotenberg/gotenberg:8).cURL, DOM, and GD (for image handling). Verify via php -m.stream() responses, then add file storage (e.g., generate()->save()).composer.json to avoid Laravel conflicts..env (e.g., GOTENBERG_DSN, CHROMIUM_FLAGS).php artisan config:cache) to avoid runtime overrides.docker logs gotenberg) for Chromium/LibreOffice errors.try-catch blocks around generate()).--ignore-certificate-errors to Chromium flags) and Gotenberg’s ability to reach Laravel’s URLs (use host.docker.internal in dev).How can I help you explore Laravel packages today?