PHPackages                             milivojsa/laravel-chrome - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. milivojsa/laravel-chrome

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

milivojsa/laravel-chrome
========================

A Laravel Wrapper for Chrome Headless. Get the DOM of any webpage.

v3.0.2(7y ago)02675MITPHPPHP ^7.1

Since Apr 6Pushed 7y ago2 watchersCompare

[ Source](https://github.com/milivojsa/laravel-chrome)[ Packagist](https://packagist.org/packages/milivojsa/laravel-chrome)[ Docs](https://github.com/milivojsa/laravel-chrome)[ RSS](/packages/milivojsa-laravel-chrome/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (3)Versions (15)Used By (0)

A Chrome Headless wrapper for Laravel
=====================================

[](#a-chrome-headless-wrapper-for-laravel)

[![Version](https://camo.githubusercontent.com/e62140398da083b2914d00a1162c5c8b7cb1a4f089c3f8ba919110c29ef2d883/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f6d696c69766f6a73612f6c61726176656c2d6368726f6d652e7376673f7374796c653d666c6174)](https://github.com/milivojsa/laravel-chrome) [![Build Status](https://camo.githubusercontent.com/d34e8e99142a713a4996f75cc37aeca32a23d270862cb355bbacb9f688597013/68747470733a2f2f7472617669732d63692e6f72672f6d696c69766f6a73612f6c61726176656c2d6368726f6d652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/milivojsa/laravel-chrome) [![StyleCI](https://camo.githubusercontent.com/a288bada66775e12fe8ad911307903b3852d00019fc69f03854e02e1b8ec4dce/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3136383731343137302f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/168714170)

Get the DOM of any webpage by using headless Chrome.

💡 This is a Laravel wrapper of [milivojsa/chrome-php](https://github.com/milivojsa/chrome-php).

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

[](#requirements)

This package requires the [Puppeteer Chrome Headless Node library](https://github.com/GoogleChrome/puppeteer).

If you want to install it on Ubuntu 16.04 you can do it like this:

```
sudo apt-get update
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
sudo npm install --global --unsafe-perm puppeteer
sudo chmod -R o+rx /usr/lib/node_modules/puppeteer/.local-chromium
```

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

[](#installation)

You can install this package via composer by running:

```
composer require milivojsa/laravel-chrome
```

After that, the package will automatically register itself.

To publish the configuration file, you need to run:

```
php artisan vendor:publish --provider="ChromeHeadless\ChromeHeadlessServiceProvider"
```

This will create a config file at `config/chrome.php`.

Configuration
-------------

[](#configuration)

The configuration can be found at `config/chrome.php`.

### Custom Chrome Path

[](#custom-chrome-path)

You can specify a custom path to your Chrome installation.

```
/*
|--------------------------------------------------------------------------
| Chrome Path
|--------------------------------------------------------------------------
|
| Manually set the path where Google Chrome is installed.
|
*/
'exec_path' => '/path/to/chrome',
```

### Custom User Agent

[](#custom-user-agent)

You can specify a custom user agent. By default the standard Chrome Headless user agent will be used.

```
/*
|--------------------------------------------------------------------------
| User Agent
|--------------------------------------------------------------------------
|
| Change the user agent that will be used by Google Chrome.
|
*/
'user_agent' => 'nice-user-agent',
```

### Timeout

[](#timeout)

You can specify a timeout after which the process will be killed. The timeout should be given in seconds.

```
/*
|--------------------------------------------------------------------------
| Timeout
|--------------------------------------------------------------------------
|
| Specify a timeout in seconds.
| (null = no timeout)
|
*/
'timeout' => 10,
```

If the process runs out of time a `Symfony\Component\Process\Exception\ProcessTimedOutException` will be thrown.

### Viewport

[](#viewport)

You can specify a custom viewport that will be used when you make a request. By default the Chrome Headless standard of 800x600px will be used.

```
/*
|--------------------------------------------------------------------------
| Viewport
|--------------------------------------------------------------------------
|
| Specify a viewport.
|
*/
'viewport' => [
                    'width' => 1920,
                    'height' => 1080
                ],
```

### Blacklist

[](#blacklist)

You can specify a list of regular expressions for files that should not be loaded when you request a website. These expressions will be checked against the url of the file.

```
/*
|--------------------------------------------------------------------------
| Blacklist
|--------------------------------------------------------------------------
|
| Specify a list of files that should not be loaded.
|
*/
'blacklist' => [
                    'www.google-analytics.com',
                    'analytics.js'
                ],
```

### Custom Headers

[](#custom-headers)

You can specify custom headers which will be used for the request.

```
/*
|--------------------------------------------------------------------------
| Additional Request Headers
|--------------------------------------------------------------------------
|
| Specify additional headers.
|
*/
'headers' => [
                'DNT' => 1 // DO NOT TRACK
             ],
```

Usage
-----

[](#usage)

Here is a quick example how to use this package:

```
use ChromeHeadless\Laravel\ChromeHeadless;

$html = ChromeHeadless::url('https://example.com')->getHtml();
```

Instead of getting the DOM as a string, you can also use the`getDOMCrawler()` method, which will return a `Symfony\Component\DomCrawler\Crawler` instance.

```
use ChromeHeadless\Laravel\ChromeHeadless;

$dom = ChromeHeadless::url('https://example.com')->getDOMCrawler();

$title = $dom->filter('title')->text();
```

This makes it easy to filter the DOM for specific elements. Check the full documentation [here](https://symfony.com/doc/current/components/dom_crawler.html).

Testing
-------

[](#testing)

You can run the tests by using

```
composer test
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 72.4% 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 ~41 days

Recently: every ~17 days

Total

10

Last Release

2581d ago

Major Versions

v1.2 → v2.02018-05-27

v2.2.1 → v3.0.02019-02-11

### Community

Maintainers

![](https://www.gravatar.com/avatar/96c1a25c968511365a6cb7eabe93c52048d59e817b951d36fa18488d826964a6?d=identicon)[milivojsa](/maintainers/milivojsa)

---

Top Contributors

[![milivojsa](https://avatars.githubusercontent.com/u/17594274?v=4)](https://github.com/milivojsa "milivojsa (21 commits)")[![helloiamlukas](https://avatars.githubusercontent.com/u/15997450?v=4)](https://github.com/helloiamlukas "helloiamlukas (6 commits)")[![torgheh](https://avatars.githubusercontent.com/u/14017891?v=4)](https://github.com/torgheh "torgheh (2 commits)")

---

Tags

laraveldomheadlesswebpagechrome

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/milivojsa-laravel-chrome/health.svg)

```
[![Health](https://phpackages.com/badges/milivojsa-laravel-chrome/health.svg)](https://phpackages.com/packages/milivojsa-laravel-chrome)
```

###  Alternatives

[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M102](/packages/spatie-browsershot)[renoki-co/clusteer

Clusteer is a Puppeteer wrapper written for PHP, with the super-power of parallelizing pages across multiple browser instances.

891.2k](/packages/renoki-co-clusteer)[urlbox/screenshots

Use urlbox to easily generate website thumbnail screenshots from a URL

14250.4k](/packages/urlbox-screenshots)[luka-dev/headless-task-server-php

Helper for sending requests to luka-dev/headless-task-server

109.6k](/packages/luka-dev-headless-task-server-php)[codexshaper/laravel-pwa

Laravel Progressive Web App

153.0k](/packages/codexshaper-laravel-pwa)

PHPackages © 2026

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