Install Playwright PHP
Add the Composer package, install browser binaries, and verify that Chromium can start.
Install the PHP package first, then download the browser targets your project runs.
Requirements
Check your tools:
php --version
node --version
composer --version
You need PHP 8.2 or newer, Node.js 20 or newer, and Composer. Node.js runs the bundled Playwright server; you do not write Node code.
Install the package
From your project root:
composer require --dev playwright-php/playwright
Expected result: Composer adds the package and creates or updates vendor/.
Install browsers
vendor/bin/playwright-install chromium
Expected result: Playwright's managed Chromium build is downloaded into the browser cache.
Install all three managed browsers when the project runs a cross-browser suite:
vendor/bin/playwright-install --browsers
This downloads Chromium, Firefox, and WebKit.
On a fresh Linux machine or CI runner, use:
vendor/bin/playwright-install --with-deps chromium
Check the install
Create hello.php:
<?php
require __DIR__.'/vendor/autoload.php';
use Playwright\Playwright;
$page = Playwright::chromium()->newPage();
$page->goto('https://example.com');
echo $page->title(), "\n";
Run it:
php hello.php
Expected result:
Example Domain
If it fails
vendor/bin/playwright-install: command not found: runcomposer require --dev playwright-php/playwrightfrom the project root.- Browser launch fails on Linux: run
vendor/bin/playwright-install --with-deps chromium. - Node is too old: install Node.js 20 or newer, then rerun the browser install.
Next: Run your first script.