PHPackages                             extractr-io/puphpeteer - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. extractr-io/puphpeteer

Abandoned → [nesk/puphpeteer](/?search=nesk%2Fpuphpeteer)ArchivedLibrary[Testing &amp; Quality](/categories/testing)

extractr-io/puphpeteer
======================

A Puppeteer bridge for PHP, supporting the entire API.

2.0.0(5y ago)1.3k3.2k↓100%210[43 issues](https://github.com/rialto-php/puphpeteer/issues)[7 PRs](https://github.com/rialto-php/puphpeteer/pulls)MITPHPPHP &gt;=7.3

Since Jan 29Pushed 3y ago28 watchersCompare

[ Source](https://github.com/rialto-php/puphpeteer)[ Packagist](https://packagist.org/packages/extractr-io/puphpeteer)[ Fund](https://www.paypal.me/johannpardanaud)[ GitHub Sponsors](https://github.com/nesk)[ RSS](/packages/extractr-io-puphpeteer/feed)WikiDiscussions dev Synced 2mo ago

READMEChangelogDependencies (6)Versions (17)Used By (0)

🚨 This project is not maintained anymore
========================================

[](#-this-project-is-not-maintained-anymore)

As I write these lines, it's been nearly two years since the latest release of PuPHPeteer. Despite the enthusiasm around this project, I no longer have the motivation to support its development, mainly because it never really had any use to me. So its time to be honest with you, PuPHPeteer is no longer maintained.

However, here's a list of forks maintained by the community:

- [zoonru/puphpeteer](https://github.com/zoonru/puphpeteer)
- [NigelCunningham/puphpeteer](https://github.com/NigelCunningham/puphpeteer)

If you create a fork and plan to maintain it, let me know and I will link it here.

PuPHPeteer
==========

[](#puphpeteer)

[![](https://user-images.githubusercontent.com/817508/100672192-dd258500-3361-11eb-845f-e8b5109752e4.png)](https://user-images.githubusercontent.com/817508/100672192-dd258500-3361-11eb-845f-e8b5109752e4.png)

[![PHP Version](https://camo.githubusercontent.com/7f189bbbfc66eb35e1c57ba653d0910cdcf7f01f966a713ee1e2d3171cf1a482/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6e65736b2f707570687065746565722e7376673f7374796c653d666c61742d737175617265)](http://php.net/)[![Composer Version](https://camo.githubusercontent.com/7d50b43d342d7d30bc16b787072dab09786e8bba30073370b3b460c1d65cc3da/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e65736b2f707570687065746565722e7376673f7374796c653d666c61742d737175617265266c6162656c3d436f6d706f736572)](https://packagist.org/packages/nesk/puphpeteer)[![Node Version](https://camo.githubusercontent.com/8fa99a42a9d6e42003dc07828812dde4b2142964305f01f801eb81655679fa40/68747470733a2f2f696d672e736869656c64732e696f2f6e6f64652f762f406e65736b2f707570687065746565722e7376673f7374796c653d666c61742d737175617265266c6162656c3d4e6f6465)](https://nodejs.org/)[![NPM Version](https://camo.githubusercontent.com/d169754edb021953eee24b67507962711b06d8306ef79ec96973605f289bcb66/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f406e65736b2f707570687065746565722e7376673f7374796c653d666c61742d737175617265266c6162656c3d4e504d)](https://www.npmjs.com/package/@nesk/puphpeteer)[![Build Status](https://camo.githubusercontent.com/fde58d10e748081ab14d2e094e73781de13d90c9d1e347912f0c270fb7f2de4c/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6e65736b2f707570687065746565722e7376673f7374796c653d666c61742d737175617265266c6162656c3d4275696c64253230537461747573)](https://travis-ci.org/nesk/puphpeteer)

A [Puppeteer](https://github.com/GoogleChrome/puppeteer/) bridge for PHP, supporting the entire API. Based on [Rialto](https://github.com/nesk/rialto/), a package to manage Node resources from PHP.

Here are some examples [borrowed from Puppeteer's documentation](https://github.com/GoogleChrome/puppeteer/blob/master/README.md#usage) and adapted to PHP's syntax:

**Example** - navigating to  and saving a screenshot as *example.png*:

```
use Nesk\Puphpeteer\Puppeteer;

$puppeteer = new Puppeteer;
$browser = $puppeteer->launch();

$page = $browser->newPage();
$page->goto('https://example.com');
$page->screenshot(['path' => 'example.png']);

$browser->close();
```

**Example** - evaluate a script in the context of the page:

```
use Nesk\Puphpeteer\Puppeteer;
use Nesk\Rialto\Data\JsFunction;

$puppeteer = new Puppeteer;

$browser = $puppeteer->launch();
$page = $browser->newPage();
$page->goto('https://example.com');

// Get the "viewport" of the page, as reported by the page.
$dimensions = $page->evaluate(JsFunction::createWithBody("
    return {
        width: document.documentElement.clientWidth,
        height: document.documentElement.clientHeight,
        deviceScaleFactor: window.devicePixelRatio
    };
"));

printf('Dimensions: %s', print_r($dimensions, true));

$browser->close();
```

Requirements and installation
-----------------------------

[](#requirements-and-installation)

This package requires PHP &gt;= 7.3 and Node &gt;= 8.

Install it with these two command lines:

```
composer require nesk/puphpeteer
npm install @nesk/puphpeteer
```

Notable differences between PuPHPeteer and Puppeteer
----------------------------------------------------

[](#notable-differences-between-puphpeteer-and-puppeteer)

### Puppeteer's class must be instantiated

[](#puppeteers-class-must-be-instantiated)

Instead of requiring Puppeteer:

```
const puppeteer = require('puppeteer');
```

You have to instantiate the `Puppeteer` class:

```
$puppeteer = new Puppeteer;
```

This will create a new Node process controlled by PHP.

You can also pass some options to the constructor, see [Rialto's documentation](https://github.com/nesk/rialto/blob/master/docs/api.md#options). PuPHPeteer also extends these options:

```
[
    // Logs the output of Browser's console methods (console.log, console.debug, etc...) to the PHP logger
    'log_browser_console' => false,
]
```

**⏱ Want to use some timeouts higher than 30 seconds in Puppeteer's API?**
If you use some timeouts higher than 30 seconds, you will have to set a higher value for the `read_timeout` option (default: `35`):

```
$puppeteer = new Puppeteer([
    'read_timeout' => 65, // In seconds
]);

$puppeteer->launch()->newPage()->goto($url, [
    'timeout' => 60000, // In milliseconds
]);
```

### No need to use the `await` keyword

[](#no-need-to-use-the-await-keyword)

With PuPHPeteer, every method call or property getting/setting is synchronous.

### Some methods have been aliased

[](#some-methods-have-been-aliased)

The following methods have been aliased because PHP doesn't support the `$` character in method names:

- `$` =&gt; `querySelector`
- `$$` =&gt; `querySelectorAll`
- `$x` =&gt; `querySelectorXPath`
- `$eval` =&gt; `querySelectorEval`
- `$$eval` =&gt; `querySelectorAllEval`

Use these aliases just like you would have used the original methods:

```
$divs = $page->querySelectorAll('div');
```

### Evaluated functions must be created with `JsFunction`

[](#evaluated-functions-must-be-created-with-jsfunction)

Functions evaluated in the context of the page must be written [with the `JsFunction` class](https://github.com/nesk/rialto/blob/master/docs/api.md#javascript-functions), the body of these functions must be written in JavaScript instead of PHP.

```
use Nesk\Rialto\Data\JsFunction;

$pageFunction = JsFunction::createWithParameters(['element'])
    ->body("return element.textContent");
```

### Exceptions must be caught with `->tryCatch`

[](#exceptions-must-be-caught-with--trycatch)

If an error occurs in Node, a `Node\FatalException` will be thrown and the process closed, you will have to create a new instance of `Puppeteer`.

To avoid that, you can ask Node to catch these errors by prepending your instruction with `->tryCatch`:

```
use Nesk\Rialto\Exceptions\Node;

try {
    $page->tryCatch->goto('invalid_url');
} catch (Node\Exception $exception) {
    // Handle the exception...
}
```

Instead, a `Node\Exception` will be thrown, the Node process will stay alive and usable.

License
-------

[](#license)

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

Logo attribution
----------------

[](#logo-attribution)

PuPHPeteer's logo is composed of:

- [Puppet](https://thenounproject.com/search/?q=puppet&i=52120) by Luis Prado from [the Noun Project](http://thenounproject.com/).
- [Elephant](https://thenounproject.com/search/?q=elephant&i=954119) by Lluisa Iborra from [the Noun Project](http://thenounproject.com/).

Thanks to [Laravel News](https://laravel-news.com/) for picking the icons and colors of the logo.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 89.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 ~86 days

Recently: every ~200 days

Total

13

Last Release

1986d ago

Major Versions

0.2.2 → 1.0.02018-06-05

1.6.0 → 2.0.02020-12-01

PHP version history (2 changes)0.1.0PHP &gt;=7.1

2.0.0PHP &gt;=7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/33cc8de5f8d4c3d66ca107b8b69afc0e8fada7e7c3a16b874ac2b3d9a438013c?d=identicon)[nesk](/maintainers/nesk)

---

Top Contributors

[![nesk](https://avatars.githubusercontent.com/u/817508?v=4)](https://github.com/nesk "nesk (110 commits)")[![spekulatius](https://avatars.githubusercontent.com/u/8433587?v=4)](https://github.com/spekulatius "spekulatius (8 commits)")[![erikgaal](https://avatars.githubusercontent.com/u/1234268?v=4)](https://github.com/erikgaal "erikgaal (2 commits)")[![xtrime-ru](https://avatars.githubusercontent.com/u/34161928?v=4)](https://github.com/xtrime-ru "xtrime-ru (2 commits)")[![nickescobedo](https://avatars.githubusercontent.com/u/2837169?v=4)](https://github.com/nickescobedo "nickescobedo (1 commits)")

---

Tags

automationdeveloper-toolsheadless-chromephppuppeteertestingwebphptestingwebautomationpuppeteerdeveloper-toolsheadless-chrome

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/extractr-io-puphpeteer/health.svg)

```
[![Health](https://phpackages.com/badges/extractr-io-puphpeteer/health.svg)](https://phpackages.com/packages/extractr-io-puphpeteer)
```

###  Alternatives

[zoon/puphpeteer

A Puppeteer bridge for PHP, supporting the entire API.

204192.9k1](/packages/zoon-puphpeteer)[nigelcunningham/puphpeteer

A Puppeteer bridge for PHP, supporting the entire API.

2221.7k](/packages/nigelcunningham-puphpeteer)[playwright-php/playwright

Modern PHP library for Playwright automation: browsing, scraping, screenshots, testing, and more.

7613.0k5](/packages/playwright-php-playwright)[doppiogancio/mocked-client

A simple way to mock a client

2174.9k3](/packages/doppiogancio-mocked-client)[victor-teles/playwright-php

A Playwright bridge for PHP.

203.6k](/packages/victor-teles-playwright-php)

PHPackages © 2026

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