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

ActiveLibrary[Testing &amp; Quality](/categories/testing)

playwright-php/performance
==========================

Performance monitoring for Playwright PHP: collect Core Web Vitals and resource metrics

v1.0.0(3mo ago)00MITPHPPHP ^8.2CI passing

Since Nov 8Pushed 3mo agoCompare

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

READMEChangelog (1)Dependencies (4)Versions (4)Used By (0)

[![Playwright 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) [![PHP Version](https://camo.githubusercontent.com/285cecd2bde9057681273322b20d539e1b9e022611dfd48d19555182b6833995/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322d3035393731423f6c6162656c436f6c6f723d30393136314526636f6c6f723d314438443233266c6f676f436f6c6f723d464646464646)](https://camo.githubusercontent.com/285cecd2bde9057681273322b20d539e1b9e022611dfd48d19555182b6833995/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322d3035393731423f6c6162656c436f6c6f723d30393136314526636f6c6f723d314438443233266c6f676f436f6c6f723d464646464646) [![CI](https://camo.githubusercontent.com/ac3f93c3263a74d5302ff6066ed70d31db94bf875a79b7900ce39199c7504a87/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f706c61797772696768742d7068702f706572666f726d616e63652f43492e796d6c3f6272616e63683d6d61696e266c6162656c3d546573747326636f6c6f723d314438443233266c6162656c436f6c6f723d303931363145266c6f676f436f6c6f723d464646464646)](https://camo.githubusercontent.com/ac3f93c3263a74d5302ff6066ed70d31db94bf875a79b7900ce39199c7504a87/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f706c61797772696768742d7068702f706572666f726d616e63652f43492e796d6c3f6272616e63683d6d61696e266c6162656c3d546573747326636f6c6f723d314438443233266c6162656c436f6c6f723d303931363145266c6f676f436f6c6f723d464646464646) [![Release](https://camo.githubusercontent.com/386a7e7de3837b215a149c56f073baf40cccb78937ab3bf4e673619f3595c725/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f706c61797772696768742d7068702f706572666f726d616e63653f6c6162656c3d537461626c65266c6162656c436f6c6f723d30393136314526636f6c6f723d314438443233266c6f676f436f6c6f723d464646464646)](https://camo.githubusercontent.com/386a7e7de3837b215a149c56f073baf40cccb78937ab3bf4e673619f3595c725/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f706c61797772696768742d7068702f706572666f726d616e63653f6c6162656c3d537461626c65266c6162656c436f6c6f723d30393136314526636f6c6f723d314438443233266c6f676f436f6c6f723d464646464646) [![License](https://camo.githubusercontent.com/46d3d9a159c29ec28c4fc6e30b7674d18dc8e76c88f9babfc1524ad3afec9ccc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f706c61797772696768742d7068702f706572666f726d616e63653f6c6162656c3d4c6963656e7365266c6162656c436f6c6f723d30393136314526636f6c6f723d314438443233266c6f676f436f6c6f723d464646464646)](https://camo.githubusercontent.com/46d3d9a159c29ec28c4fc6e30b7674d18dc8e76c88f9babfc1524ad3afec9ccc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f706c61797772696768742d7068702f706572666f726d616e63653f6c6162656c3d4c6963656e7365266c6162656c436f6c6f723d30393136314526636f6c6f723d314438443233266c6f676f436f6c6f723d464646464646)

Playwright PHP - Performance
============================

[](#playwright-php---performance)

The Performance package helps you inspect how a page behaves in a real browser by extracting Core Web Vitals and network timing data with a single API.

Features
--------

[](#features)

- Capture all Core Web Vitals directly from the browser with resilient fallbacks:
    - **LCP** (Largest Contentful Paint) - Loading performance
    - **FCP** (First Contentful Paint) - Initial render timing
    - **CLS** (Cumulative Layout Shift) - Visual stability
    - **INP** (Interaction to Next Paint) - Responsiveness (Core Web Vital as of 2024)
    - **FID** (First Input Delay) - Input responsiveness
    - **TTFB** (Time to First Byte) - Server response time
    - **TBT** (Total Blocking Time) - Main thread blocking
- Collect resource timing entries and expose them as value objects for downstream analysis.

Getting Started
---------------

[](#getting-started)

### Installation

[](#installation)

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

Usage
-----

[](#usage)

```
use Playwright\Performance\Monitor\PerformanceMonitor;
use Playwright\Playwright;

$browser = Playwright::chromium();
$page = $browser->newPage();

$monitor = new PerformanceMonitor($page);
$monitor->navigate('https://example.com');

$resources = $monitor->collectResourceMetrics();

// Core Web Vitals
$vitals = $monitor->collectCoreWebVitals();

// Resource Metrics
$resources = $monitor->collectResourceMetrics();

$browser->close();
```

### Core Web Vitals

[](#core-web-vitals)

```
// ...
// $vitals = $monitor->collectCoreWebVitals();

echo $vitals->lcp;   // Largest Contentful Paint (ms)
echo $vitals->fcp;   // First Contentful Paint (ms)
echo $vitals->cls;   // Cumulative Layout Shift
echo $vitals->inp;   // Interaction to Next Paint (ms)
echo $vitals->fid;   // First Input Delay
echo $vitals->ttfb;  // Time to First Byte (ms)
echo $vitals->tbt;   // Total Blocking Time (ms)
```

### Resources Loaded

[](#resources-loaded)

```
// ...
// $resources = $monitor->collectResourceMetrics();

foreach ($resources as $resource) {
    echo $resource->toArray();
}
```

### Format Results

[](#format-results)

```
use Playwright\Performance\Reporter\JsonReporter;
use Playwright\Performance\Reporter\MarkdownReporter;

// ...
// $resources = $monitor->collectResourceMetrics();

// JSON (default)
$reporter = new JsonReporter();
file_put_contents('report.json', $reporter->generate($vitals, $resources));

// Markdown
$reporter = new MarkdownReporter();
file_put_contents('report.md', $reporter->generate($vitals, $resources));
```

Testing
-------

[](#testing)

Use `MockPerformanceMonitor` to test your code without launching a browser:

```
use Playwright\Performance\Monitor\MockPerformanceMonitor;
use Playwright\Performance\Metrics\CoreWebVitals;

class MyServiceTest extends TestCase
{
    public function testPerformanceCheck(): void
    {
        $mock = new MockPerformanceMonitor();

        // Define expected values (optional)
        $mock->setCoreWebVitals(new CoreWebVitals(100.0, 50.0, 0.01, 0.0, 0.0, 80.0, 0.0));
        $service = new MyService($mock);

        // No real browser is launched here
        $service->analyzePerformance('https://example.com');
    }
}
```

The package also includes a PHPUnit trait with performance assertions. See the full documentation for details.

License
-------

[](#license)

This package is released by the [Playwright PHP](https://playwright-php.dev)project under the MIT License. See the [LICENSE](LICENSE) file for details.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance82

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

94d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a8951d49b371d210280a58ce48969a07d1f49924810f8a1fab3a9343eb46fdc9?d=identicon)[simonandre](/maintainers/simonandre)

---

Top Contributors

[![smnandre](https://avatars.githubusercontent.com/u/1359581?v=4)](https://github.com/smnandre "smnandre (7 commits)")

---

Tags

browsercore-web-vitalsnetworkperformancephp-browserplaywrightplaywright-phptestingtimingweb-performancemonitoringperformanceMetricsplaywrightcore-web-vitalsclsplaywright-phpFCPlcpweb-performance

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/playwright-php-performance/health.svg)

```
[![Health](https://phpackages.com/badges/playwright-php-performance/health.svg)](https://phpackages.com/packages/playwright-php-performance)
```

###  Alternatives

[phpbench/phpbench

PHP Benchmarking Framework

2.0k13.0M627](/packages/phpbench-phpbench)[dama/doctrine-test-bundle

Symfony bundle to isolate doctrine database tests and improve test performance

1.2k37.2M144](/packages/dama-doctrine-test-bundle)[friendsofcake/fixturize

CakePHP Fixture classes to help increase productivity or performance

24504.7k1](/packages/friendsofcake-fixturize)[playwright-php/playwright

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

7613.0k5](/packages/playwright-php-playwright)[treblle/treblle-php

Stay in tune with your APIs

2067.0k2](/packages/treblle-treblle-php)[jsanc623/phpbenchtime

A lightweight benchmark timer and lap profiler for PHP.

2539.1k1](/packages/jsanc623-phpbenchtime)

PHPackages © 2026

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