PHPackages                             koffleart/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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. koffleart/browsershot

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

koffleart/browsershot
=====================

Convert a webpage to an image or pdf using headless Chrome

3.37.0(6y ago)08861MITPHPPHP ^7.1

Since May 2Pushed 2y agoCompare

[ Source](https://github.com/koffleart/browsershot)[ Packagist](https://packagist.org/packages/koffleart/browsershot)[ Docs](https://github.com/spatie/browsershot)[ GitHub Sponsors](https://github.com/spatie)[ RSS](/packages/koffleart-browsershot/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (5)Versions (89)Used By (1)

[![Social Card of Spatie's Browsershot](/art/socialcard.png)](/art/socialcard.png)

Convert a webpage to an image or pdf using headless Chrome
==========================================================

[](#convert-a-webpage-to-an-image-or-pdf-using-headless-chrome)

[![Latest Version](https://camo.githubusercontent.com/75305e58f66561b3701658b8899f040d309c704922fd28ebd687d15612523fa6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7370617469652f62726f7773657273686f742e7376673f7374796c653d666c61742d737175617265)](https://github.com/spatie/browsershot/releases)[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![run-tests](https://camo.githubusercontent.com/a5fd9a05744659e0313b5fbfbe974cc732bb688060f18866ced9183eb5692871/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7370617469652f62726f7773657273686f742f72756e2d74657374732e796d6c3f6c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/spatie/browsershot/actions)[![Total Downloads](https://camo.githubusercontent.com/79c514091011985df8233d43398e4008deffa00e65f79b2de2c51a2d26c15458/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f62726f7773657273686f742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/browsershot)

The package can convert a webpage to an image or pdf. The conversion is done behind the scenes by [Puppeteer](https://github.com/GoogleChrome/puppeteer) which controls a headless version of Google Chrome.

Here's a quick example:

```
use Spatie\Browsershot\Browsershot;

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

It will save a pdf if the path passed to the `save` method has a `pdf` extension.

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

You can also use an arbitrary html input, simply replace the `url` method with `html`:

```
Browsershot::html('Hello world!!')->save('example.pdf');
```

If your HTML input is already in a file locally use the :

```
Browsershot::htmlFromFilePath('/local/path/to/file.html')->save('example.pdf');
```

Browsershot also can get the body of an html page after JavaScript has been executed:

```
Browsershot::url('https://example.com')->bodyHtml(); // returns the html of the body
```

If you wish to retrieve an array list with all of the requests that the page triggered you can do so:

```
$requests = Browsershot::url('https://example.com')
    ->triggeredRequests();

foreach ($requests as $request) {
    $url = $request['url']; //https://example.com/
}
```

To use Chrome's new [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome) pass the `newHeadless` method:

```
Browsershot::url('https://example.com')->newHeadless()->save($pathToImage);
```

Support us
----------

[](#support-us)

Learn how to create a package like this one, by watching our premium video course:

[![Laravel Package training](https://camo.githubusercontent.com/4c7f3720a29525e627f6004ee367e55def510e45d18e6bc974725812fa5cf257/68747470733a2f2f7370617469652e62652f6769746875622f7061636b6167652d747261696e696e672e6a7067)](https://laravelpackage.training)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

Documentation
-------------

[](#documentation)

All documentation is available [on our documentation site](https://spatie.be/docs/browsershot).

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

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you've found a bug regarding security please mail  instead of using the issue tracker.

Alternatives
------------

[](#alternatives)

If you're not able to install Node and Puppeteer, take a look at [v2 of browsershot](https://github.com/spatie/browsershot/tree/2.4.1), which uses Chrome headless CLI to take a screenshot. `v2` is not maintained anymore, but should work pretty well.

If using headless Chrome does not work for you take a look at at `v1` of this package which uses the abandoned `PhantomJS` binary.

Credits
-------

[](#credits)

- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)

And a special thanks to [Caneco](https://twitter.com/caneco) for the logo ✨

License
-------

[](#license)

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

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 71.8% 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 ~26 days

Recently: every ~52 days

Total

87

Last Release

2196d ago

Major Versions

0.1.3 → 1.0.02015-01-16

1.9.1 → 2.0.02017-07-03

2.4.1 → 3.0.02017-10-16

2.4.2 → 3.15.02018-01-20

PHP version history (3 changes)0.1.0PHP &gt;=5.4.0

2.0.0PHP ^7.0

3.20.1PHP ^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/6b312a582599b4ca0eaee0f55f57664477bf5eac04b786648249f698f33b3d95?d=identicon)[officialbambino](/maintainers/officialbambino)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (300 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (13 commits)")[![rubenvanassche](https://avatars.githubusercontent.com/u/619804?v=4)](https://github.com/rubenvanassche "rubenvanassche (12 commits)")[![Nielsvanpach](https://avatars.githubusercontent.com/u/10651054?v=4)](https://github.com/Nielsvanpach "Nielsvanpach (10 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (6 commits)")[![timvandijck](https://avatars.githubusercontent.com/u/4528796?v=4)](https://github.com/timvandijck "timvandijck (6 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (6 commits)")[![brendt](https://avatars.githubusercontent.com/u/6905297?v=4)](https://github.com/brendt "brendt (6 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![leonelvsc](https://avatars.githubusercontent.com/u/2332029?v=4)](https://github.com/leonelvsc "leonelvsc (4 commits)")[![darron1217](https://avatars.githubusercontent.com/u/8064923?v=4)](https://github.com/darron1217 "darron1217 (4 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")[![WidgetsBurritos](https://avatars.githubusercontent.com/u/5263371?v=4)](https://github.com/WidgetsBurritos "WidgetsBurritos (3 commits)")[![carlcs](https://avatars.githubusercontent.com/u/7516543?v=4)](https://github.com/carlcs "carlcs (3 commits)")[![EmanueleCoppola](https://avatars.githubusercontent.com/u/12816305?v=4)](https://github.com/EmanueleCoppola "EmanueleCoppola (3 commits)")[![itsgoingd](https://avatars.githubusercontent.com/u/821582?v=4)](https://github.com/itsgoingd "itsgoingd (3 commits)")[![mtawil](https://avatars.githubusercontent.com/u/700753?v=4)](https://github.com/mtawil "mtawil (3 commits)")[![patinthehat](https://avatars.githubusercontent.com/u/5508707?v=4)](https://github.com/patinthehat "patinthehat (3 commits)")[![webaddicto](https://avatars.githubusercontent.com/u/8770136?v=4)](https://github.com/webaddicto "webaddicto (2 commits)")[![ioanschmitt](https://avatars.githubusercontent.com/u/80973127?v=4)](https://github.com/ioanschmitt "ioanschmitt (2 commits)")

---

Tags

pdfconvertimageheadlesswebpagechromescreenshotpuppeteer

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k35.1M142](/packages/spatie-browsershot)[chrome-php/chrome

Instrument headless chrome/chromium instances from PHP

2.7k4.9M75](/packages/chrome-php-chrome)[gotenberg/gotenberg-php

A PHP client for interacting with Gotenberg, a developer-friendly API for converting numerous document formats into PDF files, and more!

3845.9M26](/packages/gotenberg-gotenberg-php)[spiritix/php-chrome-html2pdf

A PHP library for converting HTML to PDF using Google Chrome

151482.0k3](/packages/spiritix-php-chrome-html2pdf)[tesla-software/chrome2pdf

Convert HTML to Pdf using headless chrome.

308.1k](/packages/tesla-software-chrome2pdf)[urlbox/screenshots

Use urlbox to easily generate website thumbnail screenshots from a URL

11258.7k](/packages/urlbox-screenshots)

PHPackages © 2026

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