PHPackages                             hcancelik/sidecar-browsershot - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. hcancelik/sidecar-browsershot

AbandonedArchivedLibrary[API Development](/categories/api)

hcancelik/sidecar-browsershot
=============================

A Sidecar function to run Browsershot on Lambda.

v1.0.4(3y ago)0866MITPHPPHP ^8.0

Since Feb 13Pushed 3y agoCompare

[ Source](https://github.com/hcancelik/sidecar-browsershot)[ Packagist](https://packagist.org/packages/hcancelik/sidecar-browsershot)[ Docs](https://github.com/hcancelik/sidecar-browsershot)[ GitHub Sponsors](https://github.com/stefanzweifel)[ RSS](/packages/hcancelik-sidecar-browsershot/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (14)Versions (8)Used By (0)

Run Browsershot on AWS Lambda with Sidecar for Laravel
======================================================

[](#run-browsershot-on-aws-lambda-with-sidecar-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d08629acf0b9bae79dfed95504214d50483637a0e0d815250925354e5491ed46/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6863616e63656c696b2f736964656361722d62726f7773657273686f742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hcancelik/sidecar-browsershot)[![GitHub Tests Action Status](https://camo.githubusercontent.com/19dd893e24bb333f1010510035ec632bb75917e0d749ac891064a304cfd608c5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f73746566616e7a77656966656c2f736964656361722d62726f7773657273686f742f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/stefanzweifel/sidecar-browsershot/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/645d400ca8986504ee99779ef7d6e0f2d5798887b2e483c72569cd169fce2a05/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f73746566616e7a77656966656c2f736964656361722d62726f7773657273686f742f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/stefanzweifel/sidecar-browsershot/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/1d254d67883f72df41c5ae207ae69aa38e165d4d660c9d621ab0b274dbce1da7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6863616e63656c696b2f736964656361722d62726f7773657273686f742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hcancelik/sidecar-browsershot)

This package allows you to run [Browsershot](https://github.com/spatie/browsershot) on [AWS Lambda](https://aws.amazon.com/lambda/) through [Sidecar](https://github.com/hammerstonedev/sidecar).

You won't need to install Node, Puppeteer or Google Chrome on your server. The heavy lifting of booting a headless Google Chrome instance is happening on AWS Lambda.

Requirements
------------

[](#requirements)

This package requires that [`spatie/browsershot`](https://github.com/spatie/browsershot) and [`hammerstone/sidecar`](https://github.com/hammerstonedev/sidecar) have been installed in your Laravel application.

Follow their installation and configuration instructions. (You can skip the installation of puppeteer and Google Chrome for Browsershot though.)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require hcancelik/sidecar-browsershot
```

Register the `BrowsershotFunction::class` in your `sidecar.php` config file.

```
/*
 * All of your function classes that you'd like to deploy go here.
 */
'functions' => [
    \Hcancelik\SidecarBrowsershot\Functions\BrowsershotFunction::class,
],
```

Deploy the Lambda function by running:

```
php artisan sidecar:deploy --activate
```

See [Sidecar documentation](https://hammerstone.dev/sidecar/docs/main/functions/deploying) for details.

Usage
-----

[](#usage)

You can use `BrowsershotLambda` like the default `Browsershot`-class coming from the Spatie package. All you need to do is replace `Browsershot` with `BrowsershotLambda`.

```
use Hcancelik\SidecarBrowsershot\BrowsershotLambda;

// an image will be saved
BrowsershotLambda::url('https://example.com')->save($pathToImage);

// a pdf will be saved
BrowsershotLambda::url('https://example.com')->save('example.pdf');

// save your own HTML to a PDF
BrowsershotLambda::html('Hello world!!')->save('example.pdf');

// Get HTML of a URL and store it on a given disk
$html = BrowsershotLambda::url('https://example.com')->bodyHtml();
Storage::disk('s3')->put('example.html', $html);
```

Saving directly to S3
---------------------

[](#saving-directly-to-s3)

You can store your file directly on AWS S3.

- You must add an `s3_bucket` and `s3_region` keys added to config/sidecar.php
- You must give S3 write permissions to your sidecar-execution-role

After the above settings, you can use `saveToS3` method on `BrowsershotLambda`.

```
use Hcancelik\SidecarBrowsershot\BrowsershotLambda;
// an image will be saved on S3
BrowsershotLambda::url('https://example.com')->saveToS3('example.jpg');
// a pdf will be saved on S3
BrowsershotLambda::url('https://example.com')->saveToS3('example.pdf');
// save your own html to a PDF on S3
BrowsershotLambda::html('Hello world!!')->saveToS3('example.pdf');
```

Testing
-------

[](#testing)

The testsuite makes connections to AWS and runs the deployed Lambda function. In order to run the testsuite, you will need an active [AWS account](https://aws.amazon.com/).

We can use the native `sidecar:configure` artisan command to create the necessary AWS credentials for Sidecar. First copy the `testbench.example.yaml` file to `testbench.yaml`. Then run `./vendor/bin/testbench sidecar:configure` to start the Sidecar setup process. (You only have to do the setup once)

```
cp testbench.example.yaml testbench.yaml
cp .env.example .env
./vendor/bin/testbench sidecar:configure
```

After finishing the Sidecar setup process, you will have received a couple of `SIDECAR_*` environment variables. Add these credentials to `.env`.

Now we can deploy our local `BrowsershotFunction` to AWS Lambda. Run the following command in your terminal, before executing the testsuite.

```
./vendor/bin/testbench sidecar-browsershot:setup
```

After the successful deployment, you can run the testsuite.

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Stefan Zweifel](https://github.com/stefanzweifel)
- [Aaron Francis](https://github.com/aarondfrancis)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~16 days

Total

7

Last Release

1453d ago

Major Versions

v0.2.0 → v1.0.02022-03-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/99b75041b1a3b50e39a14bc1d2fb6ecde0fce33ce60f3b9085bf02071f0dae71?d=identicon)[hcancelik](/maintainers/hcancelik)

---

Top Contributors

[![stefanzweifel](https://avatars.githubusercontent.com/u/1080923?v=4)](https://github.com/stefanzweifel "stefanzweifel (22 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")[![hcancelik](https://avatars.githubusercontent.com/u/5788410?v=4)](https://github.com/hcancelik "hcancelik (2 commits)")[![marksalmon](https://avatars.githubusercontent.com/u/7000886?v=4)](https://github.com/marksalmon "marksalmon (1 commits)")[![aarondfrancis](https://avatars.githubusercontent.com/u/881931?v=4)](https://github.com/aarondfrancis "aarondfrancis (1 commits)")[![yoeriboven](https://avatars.githubusercontent.com/u/4047804?v=4)](https://github.com/yoeriboven "yoeriboven (1 commits)")

---

Tags

laravellambdabrowsershotsidecarsidecar-browsershothcancelik

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/hcancelik-sidecar-browsershot/health.svg)

```
[![Health](https://phpackages.com/badges/hcancelik-sidecar-browsershot/health.svg)](https://phpackages.com/packages/hcancelik-sidecar-browsershot)
```

###  Alternatives

[wnx/sidecar-browsershot

A Sidecar function to run Browsershot on Lambda.

2331.5M5](/packages/wnx-sidecar-browsershot)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.0k7.8M57](/packages/dedoc-scramble)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ryangjchandler/bearer

Minimalistic token-based authentication for Laravel API endpoints.

8129.8k](/packages/ryangjchandler-bearer)[combindma/laravel-facebook-pixel

Meta pixel integration for Laravel

4956.9k](/packages/combindma-laravel-facebook-pixel)[stechstudio/laravel-hubspot

A Laravel SDK for the HubSpot CRM Api

2971.0k](/packages/stechstudio-laravel-hubspot)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
