PHPackages                             playwright-php/playwright-symfony - 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. playwright-php/playwright-symfony

ActiveSymfony-bundle[Testing &amp; Quality](/categories/testing)

playwright-php/playwright-symfony
=================================

Playwright PHP integration for Symfony BrowserKit, DomCrawler and WebTestCase

v0.9.0(2mo ago)411[1 issues](https://github.com/playwright-php/playwright-symfony/issues)MITPHPPHP &gt;=8.3CI passing

Since Feb 20Pushed 2mo agoCompare

[ Source](https://github.com/playwright-php/playwright-symfony)[ Packagist](https://packagist.org/packages/playwright-php/playwright-symfony)[ GitHub Sponsors](https://github.com/smnandre)[ RSS](/packages/playwright-php-playwright-symfony/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (16)Versions (2)Used By (0)

[![Playwright for PHP](https://github.com/playwright-php/.github/raw/main/profile/playwright-php.png)](https://github.com/playwright-php/.github/raw/main/profile/playwright-php.png)

Playwright PHP Symfony Bundle
=============================

[](#playwright-php-symfony-bundle)

**E2E testing for Symfony with real browsers and in-process request handling.**

Run Playwright browser tests while intercepting HTTP requests and routing them through your Symfony kernel in the same PHP process—giving you full access to services, the profiler, and application state.

Important

**Alpha Status**This bundle is in active development. Core features work well, but the API may change before stable release.

Why This Bundle?
----------------

[](#why-this-bundle)

Traditional E2E testing requires running a separate web server. This bundle eliminates that overhead:

- **In-Process Request Handling**: HTTP requests from the browser are handled by your Symfony kernel in the same PHP process
- **DomCrawler Integration**: Use familiar Symfony `Crawler`, `Link`, and `Form` objects while driving a real browser
- **Full Symfony Integration**: Access services, the profiler, events, and database state during tests
- **Fast Asset Serving**: Static assets and AssetMapper files bypass the kernel for optimal performance
- **Real Browser Testing**: Test with Chromium, Firefox, or WebKit using Playwright
- **Shared Browser Session**: Optimized architecture reuses the same browser process across tests for maximum speed

Installation
------------

[](#installation)

```
composer require --dev playwright-php/playwright-symfony
```

### Prerequisites

[](#prerequisites)

**Requirements:**

- PHP 8.3+
- Symfony 7.0+ or 8.0+
- Node.js 20+ (for Playwright browser communication)

**Install Playwright:**

The bundle includes a helper to set up the Playwright environment and download browsers:

```
vendor/bin/playwright-install
vendor/bin/playwright-install --browsers
```

### Bundle Setup

[](#bundle-setup)

The bundle auto-registers in `config/bundles.php` (test environment only):

```
return [
    // ...
    Playwright\Symfony\PlaywrightSymfonyBundle::class => ['test' => true],
];
```

**Optional configuration** in `config/packages/test/playwright.yaml`:

```
playwright:
    base_url: 'http://localhost'
    intercepted_hosts: ['localhost', '127.0.0.1']
    debug_logging: false
```

Tip

You can override these values per test run via environment variables, e.g. `PLAYWRIGHT_BASE_URL`, `PLAYWRIGHT_E2E`, `PLAYWRIGHT_VERBOSE`, and `PLAYWRIGHT_HEADLESS`.

See [Configuration Reference](docs/configuration.md) for all options.

Quick Start
-----------

[](#quick-start)

### 1. Create Your Test Base Class

[](#1-create-your-test-base-class)

```
