HttpClient with Laravel’s Http facade or Guzzle).Http facade or Guzzle can replace Symfony’s HttpClient.scoped_clients.config/gotenberg.php.routes.php file would need conversion to Laravel’s Route::post() syntax.Events system.output_path config assumes filesystem storage. Laravel’s storage system (e.g., Storage::disk()) would require customization for cloud storage (S3, etc.).GOTENBERG_DSN (e.g., http://gotenberg:3000) be secured (e.g., environment variables, VPC peering)?dompdf or wkhtmltopdf)?HttpClient with Laravel’s Http facade or Guzzle. Example:
// config/gotenberg.php
'http_client' => [
'base_uri' => env('GOTENBERG_DSN'),
'timeout' => 30,
],
AppServiceProvider:
$this->app->singleton('gotenberg.client', function ($app) {
return new \GuzzleHttp\Client([
'base_uri' => config('gotenberg.http_client.base_uri'),
]);
});
routes.php to Laravel’s routes/web.php:
Route::post('/api/gotenberg', [GotenbergController::class, 'generate'])->name('gotenberg.generate');
output_path config to support Laravel’s storage system:
'output_path' => 'pdfs', // Uses Laravel's storage disk
Then use Storage::disk('local')->put() to save files.$response = Http::post('http://gotenberg:3000/forms/chromium/convert/html', [
'html' => '<h1>Test</h1>',
]);
retry helper).config/gotenberg.php with minimal changes.sensiolabs/gotenberg-bundle (Symfony) and gotenberg/gotenberg (Docker image). Laravel projects will only need the latter.# docker-compose.yml
services:
gotenberg:
image: gotenberg/gotenberg:7
ports:
- "3000:3000"
environment:
- GOTENBERG__FONTS_DIRECTORY=/tmp/gotenberg/fonts
gotenberg config file.AppServiceProvider.GotenbergService class to handle PDF generation logic.POST /api/documents/pdf).gotenberg/gotenberg image version in Docker (e.g., 7).composer.json to lock versions of indirect dependencies (e.g., Guzzle).docker logs gotenberg).Http client provides response debugging:
$response = Http::debug()->post(...);
dd($response->toArray());
GeneratePdfJob).afterCommit() to avoid long-running transactions during PDF generation.use Symfony\Component\HttpClient\RetryableHttpClient;
$client = new RetryableHttpClient(
Http::client(),
retry: [
'max_retries' => 3,
'delay' => 1000,
]
);
| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Gotenberg service down | PDF generation fails | Fallback to dompdf or queue jobs for retry. |
| Docker container crashes | Unavailable PDF generation | Health checks + auto-restart in Docker/Kubernetes. |
| API rate limiting | Slow response times | Implement retry logic with jitter. |
| Storage permission issues |
How can I help you explore Laravel packages today?