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—no need to install Node, Puppeteer, or Chrome on your servers. Deploy a Lambda function and generate PDFs/screenshots with headless Chrome handled remotely.

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 this Lambda-based solution?
Replace `Browsershot::url()->save()` with `BrowsershotLambda::url()->save()` in your code. Ensure `spatie/browsershot` and `hammerstone/sidecar` are installed, then configure the Sidecar function in `sidecar.php` and deploy via `php artisan sidecar:deploy --activate`. No core Laravel changes are needed.
Will this work with Laravel 11 or 12?
Yes, this package supports Laravel 10–13 (PHP 8.1–8.5). The API remains stable, but always check the [Sidecar](https://github.com/hammerstonedev/sidecar) and [Browsershot](https://github.com/spatie/browsershot) docs for breaking changes in newer Laravel versions.
Do I need to install Chrome or Puppeteer on my Laravel server?
No. The package offloads Chrome/Puppeteer execution to AWS Lambda, so your server only needs PHP 8.1+ and the Composer dependencies. Lambda handles the heavy lifting of booting headless Chrome.
How do I handle cold starts in Lambda for real-time PDF generation?
Enable warming by setting `SIDECAR_BROWSERSHOT_WARMING_INSTANCES` in your `.env` (e.g., `1`). Alternatively, use AWS Provisioned Concurrency to keep Lambda instances warm. Monitor cold starts with CloudWatch metrics.
Can I save generated PDFs directly to S3?
Yes. Use `BrowsershotLambda::url()->saveToS3('bucket-name', 'path/file.pdf')`. Ensure your Lambda execution role has `s3:PutObject` permissions. For large HTML inputs, upload them to S3 first using `readHtmlFromS3()`.
What happens if Lambda fails or times out?
The package throws exceptions (e.g., `SidecarException`) on failures. Implement retries in your application logic or use Sidecar’s built-in retry mechanisms. For critical paths, consider a fallback to a local Browsershot instance (though this requires Chrome/Puppeteer).
How do I add custom fonts for PDF generation?
Place font files (e.g., `.ttf`) in `resources/sidecar-browsershot/fonts/`. The Lambda layer will include them. Redeploy after adding new fonts. Note: Fonts must be synced with each Lambda deployment.
Is there a cost comparison vs. running Chrome locally?
Lambda pricing is ~$0.20 per 1M requests + compute time (~$0.00001667 per GB-second). For low-volume use (<100 PDFs/day), costs are negligible. High-volume apps may save money by avoiding server-side Chrome/Puppeteer overhead, but calculate your expected Lambda invocations.
Can I use this with Laravel Forge or shared hosting?
No. This package requires AWS Lambda and Sidecar, which are incompatible with shared hosting. Laravel Forge supports AWS, but you’ll need to configure Lambda manually or use a managed service like [AWS Amplify](https://aws.amazon.com/amplify/).
What are the alternatives to this package?
For local Chrome/Puppeteer: `spatie/browsershot` (requires Node/Chrome). For serverless alternatives: [Puppeteer Lambda](https://github.com/alexk111/puppeteer-lambda) (Node.js-based) or [Browserless](https://www.browserless.io/) (SaaS). This package is unique for its PHP-first Laravel integration with Sidecar.
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.
codraw/entity-migrator
codraw/doctrine-extra
codraw/aws-tool-kit
codraw/validator
codraw/workflow
codraw/open-api
codraw/cron-job
codraw/process
codraw/log
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony