PHPackages                             helloiamlukas/chrome-php - 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. helloiamlukas/chrome-php

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

helloiamlukas/chrome-php
========================

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

v2.0(8y ago)55.4k8[1 issues](https://github.com/helloiamlukas/chrome-php/issues)1MITPHPPHP ^7.1

Since Apr 6Pushed 8y ago1 watchersCompare

[ Source](https://github.com/helloiamlukas/chrome-php)[ Packagist](https://packagist.org/packages/helloiamlukas/chrome-php)[ Docs](https://github.com/helloiamlukas/chrome-php)[ RSS](/packages/helloiamlukas-chrome-php/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (4)Dependencies (4)Versions (5)Used By (1)

A Chrome Headless wrapper for PHP
=================================

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

[![Build Status](https://camo.githubusercontent.com/431c8b8e2be08499846d8a30d633d60a47a2f99de2b8d77ae21caef8e6753836/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f68656c6c6f69616d6c756b61732f6368726f6d652d7068702f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/helloiamlukas/chrome-php) [![StyleCI](https://camo.githubusercontent.com/7de6770955fd75dd2a8bbc7499f9833de544786ecee63cebf2c5009eeb908252/68747470733a2f2f7374796c6563692e696f2f7265706f732f3132383338333635362f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/128383656)

Get the DOM of any webpage by using headless Chrome. Inspired by [Browsershot](https://github.com/spatie/browsershot).

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)

To add this package to your project, you can install it via composer by running

```
composer require helloiamlukas/chrome-php
```

Usage
-----

[](#usage)

Here is a quick example how to use this package:

```
use ChromeHeadless\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\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).

### Timeout

[](#timeout)

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

```
ChromeHeadless::url('https://example.com')
                ->setTimeout(10)
                ->getDOMCrawler();
```

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

### Custom Chrome Path

[](#custom-chrome-path)

You can specify a custom path to your Chrome installation.

```
ChromeHeadless::url('https://example.com')
                ->setChromePath('/path/to/chrome')
                ->getDOMCrawler();
```

### Custom User Agent

[](#custom-user-agent)

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

```
ChromeHeadless::url('https://example.com')
                ->setUserAgent('nice-user-agent')
                ->getDOMCrawler();
```

### Custom Headers

[](#custom-headers)

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

```
ChromeHeadless::url('https://example.com')
                ->setHeaders([
                    'DNT' => 1 // DO NOT TRACK
                ])
                ->getDOMCrawler();
```

### 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.

```
ChromeHeadless::url('https://example.com')
                ->setBlacklist([
                    'www.google-analytics.com',
                    'analytics.js'
                ])
                ->getDOMCrawler();
```

### 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.

```
ChromeHeadless::url('https://example.com')
                ->setViewport([
                    'width' => 1920,
                    'height' => 1080
                ])
                ->getDOMCrawler();
```

Testing
-------

[](#testing)

You can run the tests by using

```
composer test
```

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~17 days

Total

4

Last Release

2995d ago

Major Versions

v1.2 → v2.02018-05-27

### Community

Maintainers

![](https://www.gravatar.com/avatar/9794facd579f33ba4692728e733edef6a48340bf66a416d7439fc4f81c041fd8?d=identicon)[helloiamlukas](/maintainers/helloiamlukas)

---

Top Contributors

[![helloiamlukas](https://avatars.githubusercontent.com/u/15997450?v=4)](https://github.com/helloiamlukas "helloiamlukas (6 commits)")

---

Tags

chrome-headlesscrawlingphpwebdomheadlesswebpagechrome

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/helloiamlukas-chrome-php/health.svg)

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.7M3.3k](/packages/craftcms-cms)[spatie/laravel-export

Create a static site bundle from a Laravel app

679153.2k7](/packages/spatie-laravel-export)[drupal/core-dev

require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.

2023.2M364](/packages/drupal-core-dev)[chameleon-system/chameleon-base

The Chameleon System core.

1028.7k6](/packages/chameleon-system-chameleon-base)[sproutcms/cms

Enterprise content management and framework

242.6k4](/packages/sproutcms-cms)[blackfire/player

A powerful web crawler and web scraper with Blackfire support

49617.1k](/packages/blackfire-player)

PHPackages © 2026

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