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 for 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 steps.

View on GitHub
Deep Wiki
Context7

A Sidecar function to run Browsershot on Lambda.

Frequently asked questions about Sidecar Browsershot
How do I migrate from local Browsershot to AWS Lambda with Sidecar in Laravel?
First, install the package via `composer require wnx/sidecar-browsershot`, then publish the config with `php artisan vendor:publish --tag=sidecar-browsershot-config`. Register `BrowsershotFunction::class` in your `sidecar.php` and deploy with `php artisan sidecar:deploy --activate`. Replace `Browsershot` with `BrowsershotLambda` in your code—no other changes are needed.
Does this package work with Laravel 10+ and PHP 8.1+?
Yes, it’s fully compatible with Laravel 10–13 and PHP 8.1–8.5. Ensure you’re using `spatie/browsershot` v5+ and `hammerstone/sidecar` for the best experience. Always check the package’s `composer.json` for minor version constraints.
What AWS resources are required to deploy this package?
You’ll need an AWS Lambda function (with Node.js 20+ runtime), an S3 bucket for large file inputs/outputs, and an IAM role with `lambda:InvokeFunction`, `s3:GetObject`, and `s3:PutObject` permissions. Sidecar handles the Lambda setup, but you must configure AWS credentials via `sidecar:configure`.
How do I handle large HTML files or high-resolution PDFs with Lambda’s 6MB payload limit?
For files exceeding 6MB, upload them to S3 first, then reference their S3 URLs in your `BrowsershotLambda` call. The Lambda function will fetch the HTML directly from S3. For outputs, save generated PDFs/images back to S3 instead of returning them directly. Use async invocations (SQS/EventBridge) for large batches.
Will Lambda cold starts slow down my PDF generation in production?
Yes, cold starts can add 100–500ms latency. Mitigate this by enabling Sidecar’s warming feature (`'warmup': true` in your `sidecar.php`) to pre-instantiate Lambdas. For critical paths, consider provisioned concurrency in AWS Lambda to reduce cold starts further.
Can I use this package without AWS Lambda (e.g., for local testing)?
No, this package is AWS Lambda-specific. For local testing, stick with `spatie/browsershot` and install Puppeteer/Chrome locally. Sidecar abstracts the Lambda layer, so you can’t bypass it without modifying the package’s core logic.
How do I update the Chromium/Puppeteer version in the Lambda Layer?
The package relies on AWS Lambda Layers for Chromium/Puppeteer. If updates break compatibility, check the Sidecar documentation for Layer versioning or manually update the Layer ARN in your `sidecar.php`. Always redeploy after changes with `php artisan sidecar:deploy --activate`.
What happens if Lambda fails during PDF generation? Does it retry automatically?
The package doesn’t include built-in retry logic, but Sidecar supports retries via its configuration. Enable retries in `sidecar.php` under `'retry'` with settings like `max_attempts` and `delay`. For critical failures, implement a fallback to local Browsershot in your application logic.
Are there cost implications for high-volume PDF generation with Lambda?
Yes, Lambda invocations and S3 storage/operations incur AWS costs. Monitor usage via CloudWatch and set budget alerts. For high-volume workloads, consider provisioned concurrency to avoid throttling and optimize costs. Async processing (SQS/EventBridge) can also reduce per-request costs.
How do I secure S3 permissions for BrowsershotLambda?
Scope S3 permissions using IAM roles with least-privilege access: restrict the Lambda execution role to only the S3 bucket(s) your app uses. Avoid wildcard permissions (`s3:*`). For sensitive data, use VPC endpoints or private S3 buckets with Lambda VPC isolation.
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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai