PHPackages                             assisted-mindfulness/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. assisted-mindfulness/browsershot

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

assisted-mindfulness/browsershot
================================

Convert a webpage to an image or pdf using headless Chrome

2.0(1y ago)6539.2k↓91.7%MITPHPPHP ^8.2CI passing

Since May 12Pushed 1y ago2 watchersCompare

[ Source](https://github.com/Assisted-Mindfulness/browsershot)[ Packagist](https://packagist.org/packages/assisted-mindfulness/browsershot)[ Docs](https://github.com/spatie/browsershot)[ RSS](/packages/assisted-mindfulness-browsershot/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (3)Dependencies (4)Versions (6)Used By (0)

Browsershot
===========

[](#browsershot)

[![Tests](https://github.com/Assisted-Mindfulness/browsershot/actions/workflows/phpunit.yaml/badge.svg)](https://github.com/Assisted-Mindfulness/browsershot/actions/workflows/phpunit.yaml)

The package can convert a webpage to an image or PDF. The conversion is done behind the screens by Google Chrome. This package has been tested on MacOS and Ubuntu. If you use another OS your mileage may vary. Chrome should be installed on your system.

On a [Forge](https://forge.laravel.com) provisioned Ubuntu server you can install the latest stable version of Chrome like this:

```
sudo wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get -f install
sudo apt-get install google-chrome-stable
```

Also, if necessary, you need to install additional resources, such as fonts for displaying emoji:

```
sudo apt-get install fonts-noto-color-emoji
```

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

[](#installation)

This package can be installed through Composer.

```
composer require assisted-mindfulness/browsershot
```

Usage
-----

[](#usage)

In all examples it is assumed that you imported this namespace at the top of your file

```
use AssistedMindfulness\Browsershot\Browsershot;
```

Here's the easiest way to create an image of a webpage:

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

Browsershot will make an educated guess where Google Chrome is located. If Chrome can not be found on your system you can manually set its location:

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

By default the screenshot will be a `png` and it's size will match the resolution you use for your desktop. Want another size of screenshot? No problem!

```
Browsershot::url('https://example.com')
    ->windowSize(640, 480)
    ->save($pathToImage);
```

You can also capture the webpage at higher pixel densities by passing a device scale factor value of 2 or 3. This mimics how the webpage would be displayed on a retina/xhdpi display.

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

If, for some reason, you want to set the user agent Google Chrome should use when taking the screenshot you can do so:

```
Browsershot::url('https://example.com')
    ->userAgent('My Special Snowflake Browser 1.0')
    ->save($pathToImage);
```

The default timeout of Browsershot is set to 60 seconds. Of course, you can modify this timeout:

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

Browsershot 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');
```

Alternatively you can explicitly use the `savePdf` method:

```
Browsershot::url('https://example.com')->savePdf('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
```

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

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

License
-------

[](#license)

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

---

This is a fork of the [spatie/browsershot](https://github.com/spatie/browsershot) project which does not require Node and Puppeteer to be installed on your web server.

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance46

Moderate activity, may be stable

Popularity32

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 93.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 ~548 days

Total

3

Last Release

417d ago

Major Versions

1.0.1 → 2.02025-05-12

PHP version history (2 changes)1.0.0PHP ^8.0

2.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/3c47797b11041f37c2eec74b09bc6619c8997467d690797ebad0e6ab7cb232b7?d=identicon)[tabuna](/maintainers/tabuna)

---

Top Contributors

[![tabuna](https://avatars.githubusercontent.com/u/5102591?v=4)](https://github.com/tabuna "tabuna (27 commits)")[![SadElephant](https://avatars.githubusercontent.com/u/7434276?v=4)](https://github.com/SadElephant "SadElephant (2 commits)")

---

Tags

pdfphpscreenshotbrowserpdfconvertimageheadlesswebpagechromescreenshot

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k36.7M156](/packages/spatie-browsershot)[chrome-php/chrome

Instrument headless chrome/chromium instances from PHP

2.7k5.1M85](/packages/chrome-php-chrome)[pontedilana/php-weasyprint

PHP library allowing PDF generation from an url or a html page. Wrapper for Kozea/WeasyPrint.

781.2M17](/packages/pontedilana-php-weasyprint)[urlbox/screenshots

Use urlbox to easily generate website thumbnail screenshots from a URL

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

Convert HTML to Pdf using headless chrome.

308.1k](/packages/tesla-software-chrome2pdf)[karkowg/php-mupdf

Minimal PDF to image converter using MuPDF

203.4k](/packages/karkowg-php-mupdf)

PHPackages © 2026

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