wnx/sidecar-browsershot
Run Spatie Browsershot on AWS Lambda via Sidecar in Laravel. Generate PDFs/screenshots without installing Node, Puppeteer, or Chrome on your server—headless Chrome runs in a deployed Lambda function. Includes config publishing and Sidecar deploy workflow.
barryvdh/laravel-dompdf or spatie/browsershot but extends functionality to serverless deployments. The package abstracts the complexity of running Chromium in Lambda, making it ideal for:
spatie/browsershot or similar packages; wraps them in a Sidecar-compatible layer.puppeteer/php). Mitigation: Use composer’s replace or isolate Sidecar in a dedicated microservice./tmp).| Risk Area | Description | Mitigation Strategy |
|---|---|---|
| Sidecar Initialization | Sidecar may fail to start due to misconfigured IAM roles or missing dependencies. | Use AWS Lambda Layers for Sidecar binaries; validate IAM permissions pre-deploy. |
| IPC Latency | Communication between Lambda and Sidecar adds overhead (~100–500ms). | Benchmark with real-world payloads; consider caching static renders. |
| Cold Starts | Sidecar itself may experience cold starts if not kept warm. | Use Lambda Provisioned Concurrency for Sidecar; or deploy as a Fargate task. |
| Dependency Bloat | Sidecar adds Chromium (~300MB) to Lambda’s environment. | Use Lambda SnapStart or custom runtime to reduce footprint. |
| Debugging Complexity | Distributed tracing (Lambda + Sidecar) requires setup. | Integrate AWS X-Ray or OpenTelemetry for end-to-end observability. |
spatie/browsershot or barryvdh/laravel-dompdf.Phase 1: Proof of Concept (PoC)
/generate-pdf) with Sidecar-enabled Browsershot.aws-lambda-php extension for Sidecar; test locally with SAM CLI or Docker.Phase 2: Integration
// Before: Direct Browsershot call
$pdf = (new Browsershot)->html($html)->pdf()->save('invoice.pdf');
// After: Sidecar proxy
$sidecar = new SidecarBrowsershot();
$pdf = $sidecar->render($html)->toS3('invoices/');
Phase 3: Optimization
| Component | Compatibility Notes |
|---|---|
| Laravel Packages | Works with spatie/browsershot, dompdf, or custom Chromium-based renderers. |
| AWS Lambda | Requires PHP 8.0+ runtime; test with ARM64/Graviton for cost savings. |
| Chromium Version | Sidecar bundles its own Chromium; ensure it matches your app’s requirements. |
| Networking | Sidecar must be reachable from Lambda (same VPC or public API endpoint). |
| Storage | Input/output must be S3-compatible (e.g., MinIO for non-AWS). |
composer require wnx/sidecar-browsershot).{
"timestamp
How can I help you explore Laravel packages today?