github zoonru/puphpeteer v3.0.0-beta2

pre-release3 hours ago

This release expands npm plugin support, adds Web APIs to the QuickJS runtime, and improves binary transfers, streaming and concurrent PHP callbacks. Puppeteer continues to run inside PHP without a Node.js process.

Highlights

  • Application-owned npm plugins: load CommonJS packages directly from your application's node_modules through JsRuntime::require(). Plugin upgrades no longer require rebuilding Puphpeteer. Includes a runnable stealth + fingerprint example.
  • Shared JavaScript runtime: loaded packages, custom JavaScript functions and Puppeteer can use the same QuickJS context.
  • Expanded Web API support: URL, URLSearchParams, structuredClone, DOMException, setImmediate and clearImmediate. Fixes ReferenceError: URL is not defined, including cookie operations.
  • Streaming UTF-8 decoding: optimized TextEncoder and TextDecoder, with {stream: true}, correct handling of split characters and a final decode() flush.
  • Modern cancellation APIs: AbortSignal.reason, throwIfAborted(), abort(), timeout() and any().
  • PHP-backed host fetch: fetch, Headers, Request and Response, with streamed response bodies, redirects, cloning and cancellation of underlying PHP I/O.
  • PHP-backed crypto: secure crypto.getRandomValues(), randomUUID() and subtle.digest() for SHA-1, SHA-256, SHA-384 and SHA-512.

Performance and reliability

  • Load the bundled JavaScript directly, bypassing unnecessary TypeScript transpilation.
  • Transfer filesystem data as native bytes and decode screenshot, PDF and recording payloads in PHP.
  • Stream file recordings directly to the PHP filesystem with backpressure, fixing unbounded buffering.
  • Fix shared PHP callback lifetimes during concurrent operations.
  • Fix zero-delay timer scheduling and improve request cleanup during shutdown.

Breaking changes from beta1

  • Requires PHP 8.4+ and php-quickjs >= 0.0.3 from the php-quickjs fork. Use the extension revision pinned in Dockerfile.
  • Bundled plugin names and the build-time plugin registry are replaced by application-owned npm packages. Replace use('stealth') with:
use Nesk\Puphpeteer\JsRuntime;
use Nesk\Puphpeteer\Puppeteer\Puppeteer;

$js = new JsRuntime(moduleRoot: __DIR__);
$stealth = $js->require('puppeteer-extra-plugin-stealth');

$puppeteer = new Puppeteer(runtime: $js);
$puppeteer->use($stealth());
$browser = $puppeteer->launch();

Install plugins with npm and include node_modules in deployment. Node.js is not required at runtime.

  • Recordings created with path write directly to disk and return an empty stream after stop(). Omit path to consume live video bytes.

Installation

composer require zoon/puphpeteer:3.0.0-beta2
php vendor/bin/console browser:install

Skip browser installation when using Browserless or an existing Chrome executable.

Known limitations

npm compatibility covers CommonJS packages and selected Node builtins; ESM-only packages may need a build step.

Host fetch runs independently of Chrome and does not inherit its cookies, proxies or authentication. Streaming uploads and Blob/FormData are unsupported. Encryption, signatures and key management are not implemented.

Only Chrome/Chromium through CDP is supported. Firefox, pipe transport, Node.js writable streams, the legacy screencast() API and followSymlinks: false are unsupported.

Full Changelog: v3.0.0-beta1...v3.0.0-beta2

Don't miss a new puphpeteer release

NewReleases is sending notifications on new releases.