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.
sidecar:dispatch) for async processing, enabling scalability for batch operations (e.g., generating reports).spatie/browsershot with a Lambda-powered alternative. Uses Laravel’s service container and Artisan commands (sidecar:deploy).hammerstone/sidecar (v2.0+), which must be configured for AWS Lambda. Adds complexity but provides a robust serverless abstraction.spatie/browsershot API, enabling drop-in replacement for existing codebases. Supports v5+ (as of v2.5.0).SIDECAR_BROWSERSHOT_WARMING_INSTANCES.spatie/image for advanced features (e.g., fit()), adding optional dependencies.saveToS3)?spatie/browsershot.sidecar:dispatch).aws disk config).spatie/image: For advanced image manipulation (e.g., resizing).spatie/browsershot: Core dependency (v5+).hammerstone/sidecar and configure AWS credentials (sidecar:configure).composer require wnx/sidecar-browsershot spatie/browsershot
php artisan vendor:publish --tag="sidecar-browsershot-config"
BrowsershotFunction in sidecar.php:
'functions' => [
\Wnx\SidecarBrowsershot\Functions\BrowsershotFunction::class,
],
filesystems.php (if using saveToS3).php artisan sidecar:deploy --activate
Browsershot::url() with BrowsershotLambda::url().// Before
Browsershot::url('https://example.com')->save('file.pdf');
// After
BrowsershotLambda::url('https://example.com')->saveToS3('file.pdf');
sidecar-browsershot:setup).spatie/browsershot methods (e.g., windowSize(), pdf(), bodyHtml()).spatie/image (downloads to local disk temporarily).spatie/image for image manipulation.sidecar-browsershot-layer).sidecar-browsershot.php and sidecar.php in version control.spatie/browsershot or Sidecar.resources/sidecar-browsershot/fonts folder.PayloadTooLarge errors (switch to S3).saveToS3).reserved_concurrent_executions if needed.SIDECAR_BROWSERSHOT_WARMING_INSTANCES (e.g., 3–5) for low-latency needs.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Lambda cold starts | High latency (~500ms–2s) | Provisioned concurrency or warming. |
| Lambda throttling | Request |
How can I help you explore Laravel packages today?