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
Sidecar Browsershot

Sidecar Browsershot Laravel Package

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.

View on GitHub
Deep Wiki
Context7

A Sidecar function to run Browsershot on Lambda.

Frequently asked questions about Sidecar Browsershot
How does this package solve Chromium’s limitations in AWS Lambda?
This package offloads Browsershot rendering to a Sidecar container running alongside your Lambda, bypassing Lambda’s 15-minute timeout and memory constraints. The Sidecar handles Chromium’s heavy lifting independently, while your Lambda remains lightweight for orchestration.
Can I use this with Laravel 7 or PHP 7.4?
No, this package requires Laravel 8+ and PHP 8.0+ due to Sidecar’s AWS SDK dependencies. If you’re on an older stack, consider alternatives like Puppeteer Cloud or pre-rendering with CloudFront.
Do I need to install Chrome or Puppeteer locally?
No, this package abstracts Chromium entirely—it runs only in the Sidecar container on AWS Lambda. You’ll skip Chrome/Puppeteer installation in your Laravel app, but the Sidecar must have Chromium pre-installed in its Docker image.
How do I handle PDFs or screenshots larger than Lambda’s /tmp storage?
Store outputs directly in S3 or EFS. The package supports streaming files to cloud storage, avoiding Lambda’s ephemeral storage limits. Configure the `storage` option in the published config to point to your preferred backend.
Will this work with existing spatie/browsershot code?
Yes, the package wraps Browsershot’s API seamlessly. Replace `Browsershot::html()` with `BrowsershotLaravel::html()`—the rest of your code (e.g., PDF margins, formats) remains unchanged. Just ensure you’ve published the config and deployed the Sidecar.
What’s the performance impact of using Sidecar vs. running Chromium locally?
Sidecar adds ~100–500ms latency for inter-process communication (IPC) between Lambda and the container. However, it eliminates cold starts and memory constraints, making it faster for long-running tasks (e.g., complex PDFs or SPAs) in serverless environments.
How do I debug issues if the Sidecar fails to render?
Enable AWS CloudWatch Logs for both Lambda and Sidecar. Use the `sidecar:logs` Artisan command to inspect Sidecar output. For Chromium-specific errors, check the Sidecar’s Docker logs or adjust its memory limits in the Lambda configuration.
Can I use this with other Laravel PDF packages like laravel-dompdf?
No, this package is specifically for `spatie/browsershot`. If you’re using `laravel-dompdf`, consider alternatives like AWS Textract or third-party APIs, as dompdf uses a different rendering engine (HTML5Lib) and isn’t compatible with Sidecar’s Chromium-based approach.
What’s the cost difference vs. running Browsershot on EC2 or a server?
Sidecar on Lambda can be cheaper for sporadic usage, as you pay per invocation rather than idle server costs. However, frequent Sidecar calls (e.g., per-user PDFs) may incur higher costs due to Lambda’s pricing model. Compare with pre-rendering (e.g., CloudFront) or batch processing.
How do I scale this for high traffic (e.g., 1000+ concurrent requests)?
Use Lambda concurrency limits to throttle requests and deploy Sidecar as a Fargate task for better scalability. Alternatively, implement a queue (SQS) to batch requests and reduce Sidecar load. Monitor with CloudWatch and adjust memory/CPU allocations as needed.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4