Library / SDK
php-webdriver/php-webdriver avatar
php-webdriver/php-webdriver

php-webdriver kept the Facebook namespace after the 1.8.0 rename

PHP client for Selenium/WebDriver protocol. Previously facebook/php-webdriver

5,192 stars840 forksPHPMIT

At a glance

What is it?
A PHP binding for the Selenium WebDriver protocol that can talk to a Selenium standalone server, Chromedriver or Geckodriver, supports both the W3C and legacy protocols, and still exposes every class under the Facebook WebDriver namespace.
Who is it for?
Take php-webdriver when your PHP suite has to drive a real browser and you want one binding for both a local driver process and a Selenium grid. Its limits are concrete: the browser and driver versions must be paired by hand, the legacy JsonWireProtocol is still carried alongside W3C WebDriver, and the README states outright that its snippets are not a runnable example.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 9 days ago.
What is it written in?
Mainly PHP, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • php-webdriver/php-webdriver5,192 ★ · -4
Star history
Repository2026-09-232026-11-15
php-webdriver/php-webdriver5.2k5.2k

-4 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The package was renamed in 1.8.0, the namespace was not

Since version 1.8.0 the distribution is `php-webdriver/webdriver`, renamed from `facebook/php-webdriver`. Composer picks up new releases only after you change the key yourself, and the README is explicit about the edit:

diff
"require": {
-    "facebook/webdriver": "(version you use)",
+    "php-webdriver/webdriver": "(version you use)",
}

then `composer update`. The catch sits one level deeper. Every class in every example is imported from `Facebook\WebDriver\Remote\RemoteWebDriver` and `Facebook\WebDriver\Firefox\FirefoxOptions`, so your require key says php-webdriver while your use statements say Facebook. That mismatch is not a bug to report; it is the shape of the library. It also explains why search results and older tutorials are still partly usable: the code you find under an old name may match the API you installed.

The server URL you pass decides which remote end answers

Nothing works until a remote end is listening, and the URL is the only thing this library needs to find it. The README gives the four forms explicitly:

php
// Chromedriver (if started using --port=4444 as above)
$serverUrl = 'http://localhost:4444';
// Geckodriver
$serverUrl = 'http://localhost:4444';
// selenium-server-standalone-#.jar (version 2.x or 3.x)
$serverUrl = 'http://localhost:4444/wd/hub';
// selenium-server-standalone-#.jar (version 4.x)
$serverUrl = 'http://localhost:4444';

The difference between line three and line four is the `/wd/hub` path, which Selenium 4 dropped. Pair the wrong URL with the wrong server version and the session never opens, and the README offers no error text for that case. Once the URL is right, the session itself is three factory calls:

php
use Facebook\WebDriver\Remote\RemoteWebDriver;

// Chrome
$driver = RemoteWebDriver::create($serverUrl, DesiredCapabilities::chrome());

with `DesiredCapabilities::firefox()` and `DesiredCapabilities::microsoftEdge()` alongside it.

Chromedriver and Geckodriver each need a matching browser build

For local work the README skips the Selenium server entirely and points the library straight at a driver binary. The setup for Chrome is to install the latest Chrome and Chromedriver, then run the binary and pass the port you want it to listen on:

sh
chromedriver --port=4444

Firefox is the same shape, with the port already chosen:

sh
geckodriver

Both sections carry the same warning twice, once for each browser: make sure the driver version matches the browser version. That pairing lives outside PHP entirely, because the library only speaks to whatever is already listening on the port. A green suite on a developer laptop says nothing about whether CI has the same Chrome build. The README answers the compatibility question with wiki pages for Chrome and Firefox rather than with a version table, so a drifting CI image is something you detect and fix in the image, not in the test code.

Desired capabilities carry the headless switch and the certificate decision

Capabilities describe the browser you are about to start, and the README uses them for three jobs. The first is browser flags that have no other home, passed through a browser specific options object:

php
$desiredCapabilities->setCapability('acceptSslCerts', false);

// Add arguments via FirefoxOptions to start headless firefox
$firefoxOptions = new FirefoxOptions();
$firefoxOptions->addArguments(['-headless']);
$desiredCapabilities->setCapability(FirefoxOptions::CAPABILITY, $firefoxOptions);

Note that the example sets acceptSslCerts to false on the same object, which disables accepting SSL certificates. The second job is the proxy: the README points at a wiki page for configuring a proxy server through capabilities, so routing browser traffic is a capability concern and not a PHP client option. The third is escaping the defaults, where ChromeOptions and FirefoxOptions carry the browser specific keys, with the W3C WebDriver specification and the legacy JsonWire capability documentation named as the places to read further.

The README says its own snippets are not a working example

There is a note at the end of the getting started section saying the snippets are not intended to be a working example by simply copy-pasting, and it points at `example.php`. That file sits at the top level of the repository next to README.md, composer.json and LICENSE.md, so the runnable scenario is one directory away from the prose. What the snippets do show is the shape of the control flow: `$driver->get()` for navigation, then `findElement()` chained with `WebDriverBy::id('searchInput')`, `sendKeys('PHP')` and `submit()` to fill and submit a form, then a second lookup with `WebDriverBy::cssSelector('#ca-history a')` and `getText()` to read an element back. The element location strategy is the part worth internalising, because it is where most test code lives, and the wiki carries an example command reference alongside a Chrome page and a Firefox page for the options objects.

Selenium server earns its keep in parallel runs and grid mode

A driver process on your own machine is enough for one browser and one test run. The README gives Selenium standalone server three jobs beyond that. Run several tests at once, run the same suite across several different browsers, which is the CI case it names explicitly, or distribute tests across several machines in grid mode, where one Selenium server acts as a hub and the others connect to it as nodes. In that last arrangement the server behaves as a proxy and takes care of routing commands to the right node, which means your browser session creation code does not change when you move from one process to a fleet. Two ways to obtain it are named: the download page for the latest version, and a Docker container through the docker-selenium project. The practical read for a team is that concurrency and browser coverage are server level decisions, and the PHP binding stays the same across all three setups.

lib/ and tests/ carry the code, logs/ carries something else

The repository layout explains the shape of the project better than the README does. `lib/` holds the library, `tests/` the suite, with `phpunit.xml.dist` for its configuration and `phpstan.neon` for static analysis. Style is enforced by `.php-cs-fixer.dist.php` and coverage is reported through `.coveralls.yml`. A `tools/` directory and a `scripts/` directory sit beside the tests, `mlc_config.json` configures link checking for the documentation, and there is a top level `logs/` directory in the tree. Version history is not published as GitHub releases, so `CHANGELOG.md` in the tree is the record to read when you need to know what a release changed. The last push to the repository landed on 2026-10-28, so the branch is being worked on; the compatibility range the README states is Selenium server 2.x, 3.x and 4.x, with no PHP version matrix given for this library in the same breath.

Editorial conclusion

Take php-webdriver when your PHP suite has to drive a real browser and you want one binding for both a local driver process and a Selenium grid. Its limits are concrete: the browser and driver versions must be paired by hand, the legacy JsonWireProtocol is still carried alongside W3C WebDriver, and the README states outright that its snippets are not a runnable example. Before wiring it in, rename any facebook/webdriver requirement to php-webdriver/webdriver and run composer update, then read example.php at the top of the repository rather than copying the README blocks.

Frequently asked questions

What is WebDriver and what is its purpose?

WebDriver is the protocol this library binds. php-webdriver is a PHP language binding for Selenium WebDriver, which lets you control web browsers from PHP, and it speaks the modern W3C WebDriver protocol as well as the legacy JsonWireProtocol.

What is the difference between Selenium and WebDriver?

Selenium is the project behind the server and the official Java, JavaScript, .NET, Python and Ruby libraries. php-webdriver is a separate PHP binding whose concepts mirror those libraries, and it is compatible with Selenium server versions 2.x, 3.x and 4.x.

What is Selenium WebDriver used for?

For driving a browser from PHP. You start a remote end such as Selenium standalone server, Chromedriver or Geckodriver, pass its URL to RemoteWebDriver::create() with a DesiredCapabilities object, then navigate and act through findElement, sendKeys and submit.

What is the difference between ChromeDriver and WebDriver?

ChromeDriver is one remote end you can point this library at directly, started as chromedriver --port=4444, while WebDriver is the protocol and this library is the PHP binding for it. A Selenium standalone server is another remote end, and in grid mode one server acts as a hub with the others as nodes.

Official sources

  1. Issues
  2. License: MIT
  3. php-webdriver/php-webdriver on GitHub
  4. README
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/php-webdriver-php-webdriver.svg)](https://hysenlabs.com/projects/php-webdriver-php-webdriver)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/php-webdriver-php-webdriver.svg)](https://hysenlabs.com/projects/php-webdriver-php-webdriver)

Was this useful?