PHPackages                             ergebnis/phpunit-agent-reporter - 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. ergebnis/phpunit-agent-reporter

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

ergebnis/phpunit-agent-reporter
===============================

Provides an extension for reporting phpunit/phpunit test execution details to agents.

1.0.0(1mo ago)713.9k↑15.3%2MITPHPPHP ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0CI passing

Since Apr 7Pushed 1w agoCompare

[ Source](https://github.com/ergebnis/phpunit-agent-reporter)[ Packagist](https://packagist.org/packages/ergebnis/phpunit-agent-reporter)[ Docs](https://github.com/ergebnis/phpunit-agent-reporter)[ RSS](/packages/ergebnis-phpunit-agent-reporter/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (4)Dependencies (30)Versions (6)Used By (2)

phpunit-agent-reporter
======================

[](#phpunit-agent-reporter)

[![Integrate](https://github.com/ergebnis/phpunit-agent-reporter/workflows/Integrate/badge.svg)](https://github.com/ergebnis/phpunit-agent-reporter/actions)[![Merge](https://github.com/ergebnis/phpunit-agent-reporter/workflows/Merge/badge.svg)](https://github.com/ergebnis/phpunit-agent-reporter/actions)[![Nightly](https://github.com/ergebnis/phpunit-agent-reporter/workflows/Nightly/badge.svg)](https://github.com/ergebnis/phpunit-agent-reporter/actions)[![Release](https://github.com/ergebnis/phpunit-agent-reporter/workflows/Release/badge.svg)](https://github.com/ergebnis/phpunit-agent-reporter/actions)[![Renew](https://github.com/ergebnis/phpunit-agent-reporter/workflows/Renew/badge.svg)](https://github.com/ergebnis/phpunit-agent-reporter/actions)

[![Code Coverage](https://camo.githubusercontent.com/4858619b1d600575684e0bf1a8be1fa0d77caa03f74a1be8446711d34f7d11e6/68747470733a2f2f636f6465636f762e696f2f67682f65726765626e69732f706870756e69742d6167656e742d7265706f727465722f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/ergebnis/phpunit-agent-reporter)

[![Latest Stable Version](https://camo.githubusercontent.com/2655d2b016b3c9343ff20d09cf394aebfaf251657dde9e154e74a6399677d224/68747470733a2f2f706f7365722e707567782e6f72672f65726765626e69732f706870756e69742d6167656e742d7265706f727465722f762f737461626c65)](https://packagist.org/packages/ergebnis/phpunit-agent-reporter)[![Total Downloads](https://camo.githubusercontent.com/9efcca7913591e157fc5295e8dc078df22807285c8e0b15f43ee2e27498497ca/68747470733a2f2f706f7365722e707567782e6f72672f65726765626e69732f706870756e69742d6167656e742d7265706f727465722f646f776e6c6f616473)](https://packagist.org/packages/ergebnis/phpunit-agent-reporter)[![Monthly Downloads](https://camo.githubusercontent.com/a954eacb6c4ea3a49925cff769f059fe4b6e345eefc519df0dfdc9b00d767383/687474703a2f2f706f7365722e707567782e6f72672f65726765626e69732f706870756e69742d6167656e742d7265706f727465722f642f6d6f6e74686c79)](https://packagist.org/packages/ergebnis/phpunit-agent-reporter)

This project provides a [`composer`](https://getcomposer.org) package and a [Phar archive](https://www.php.net/manual/en/book.phar.php) with an extension for reporting [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit) test execution details to agents.

Example
-------

[](#example)

After installing and bootstrapping the extension, when running your tests with `phpunit/phpunit`, the extension will detect whether an agent is running the tests and replace the default output with test execution details that are easier for agents to consume.

When tests pass, the extension outputs:

```
{
    "result": "success",
    "summary": {
        "assertions": 5,
        "deprecations": 0,
        "errors": 0,
        "failures": 0,
        "incomplete": 0,
        "notices": 0,
        "risky": 0,
        "skipped": 0,
        "tests": 5,
        "warnings": 0
    }
}
```

When tests fail (exit code 1), the extension outputs:

```
{
    "result": "failure",
    "summary": {
        "assertions": 5,
        "deprecations": 0,
        "errors": 0,
        "failures": 2,
        "incomplete": 0,
        "notices": 0,
        "risky": 0,
        "skipped": 0,
        "tests": 5,
        "warnings": 0
    },
    "details": {
        "failures": [
            {
                "file": "/path/to/ExampleTest.php",
                "line": 27,
                "message": "Failed asserting that false is true.",
                "test": "Namespace\\ExampleTest::testFailing"
            },
            {
                "actual": "bar",
                "diff": "--- Expected\n+++ Actual\n@@ @@\n-'foo'\n+'bar'\n",
                "expected": "foo",
                "file": "/path/to/ExampleTest.php",
                "line": 34,
                "message": "Failed asserting that two strings are identical.",
                "test": "Namespace\\ExampleTest::testComparisonFailing"
            }
        ]
    }
}
```

When tests fail with comparison assertions, the `actual`, `diff`, and `expected` fields provide details about the mismatch. These fields are only present for comparison failures.

When tests error (exit code 2), the extension outputs:

```
{
    "result": "exception",
    "summary": {
        "assertions": 5,
        "deprecations": 0,
        "errors": 1,
        "failures": 2,
        "incomplete": 0,
        "notices": 0,
        "risky": 0,
        "skipped": 0,
        "tests": 5,
        "warnings": 0
    },
    "details": {
        "errors": [
            {
                "file": "/path/to/ExampleTest.php",
                "line": 32,
                "message": "Something went wrong.",
                "test": "Namespace\\ExampleTest::testErroring"
            }
        ],
        "failures": [
            {
                "file": "/path/to/ExampleTest.php",
                "line": 27,
                "message": "Failed asserting that false is true.",
                "test": "Namespace\\ExampleTest::testFailing"
            },
            {
                "actual": "bar",
                "diff": "--- Expected\n+++ Actual\n@@ @@\n-'foo'\n+'bar'\n",
                "expected": "foo",
                "file": "/path/to/ExampleTest.php",
                "line": 34,
                "message": "Failed asserting that two strings are identical.",
                "test": "Namespace\\ExampleTest::testComparisonFailing"
            }
        ]
    }
}
```

The `summary` always reports the count for every category, so that an agent has a complete overview of the test run. The `details` section, however, only contains an entry for a category when the test run produces at least one occurrence of it, so that an agent has all the information it can act on without unnecessary noise. For example, when tests trigger deprecations, the extension outputs:

```
{
    "result": "success",
    "summary": {
        "assertions": 5,
        "deprecations": 1,
        "errors": 0,
        "failures": 0,
        "incomplete": 0,
        "notices": 0,
        "risky": 0,
        "skipped": 0,
        "tests": 5,
        "warnings": 0
    },
    "details": {
        "deprecations": [
            {
                "file": "/path/to/ExampleTest.php",
                "line": 42,
                "message": "Method Namespace\\Example::doSomething() is deprecated.",
                "triggeredBy": [
                    "Namespace\\ExampleTest::testTriggeringDeprecation"
                ]
            }
        ]
    }
}
```

The JSON output conforms to the [JSON schema](schema/agent-report-schema.json) included in this package.

### Agent Detection

[](#agent-detection)

The extension uses [`ergebnis/agent-detector`](https://github.com/ergebnis/agent-detector) to detect the presence of agents.

Compatibility
-------------

[](#compatibility)

The extension is compatible with the following versions of `phpunit/phpunit`:

- [`phpunit/phpunit:^13.0.0`](https://github.com/sebastianbergmann/phpunit/tree/13.0.0)
- [`phpunit/phpunit:^12.0.0`](https://github.com/sebastianbergmann/phpunit/tree/12.0.0)
- [`phpunit/phpunit:^11.0.0`](https://github.com/sebastianbergmann/phpunit/tree/11.0.0)
- [`phpunit/phpunit:^10.0.0`](https://github.com/sebastianbergmann/phpunit/tree/10.0.0)

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

[](#installation)

### Installation with `composer`

[](#installation-with-composer)

Run

```
composer require --dev ergebnis/phpunit-agent-reporter
```

to install `ergebnis/phpunit-agent-reporter` as a `composer` package.

### Installation as Phar

[](#installation-as-phar)

Download `phpunit-agent-reporter.phar` from the [latest release](https://github.com/ergebnis/phpunit-agent-reporter/releases/latest).

Usage
-----

[](#usage)

### Bootstrapping the extension

[](#bootstrapping-the-extension)

Before the extension can report test execution details in `phpunit/phpunit`, you need to bootstrap it.

### Bootstrapping the extension as a `composer` package

[](#bootstrapping-the-extension-as-a-composer-package)

To bootstrap the extension as a `composer` package when using

- `phpunit/phpunit:^13.0.0`
- `phpunit/phpunit:^12.0.0`
- `phpunit/phpunit:^11.0.0`
- `phpunit/phpunit:^10.0.0`

adjust your `phpunit.xml` configuration file and configure the

- [`extensions` element](https://docs.phpunit.de/en/13.0/configuration.html#the-extensions-element) on [`phpunit/phpunit:^13.0.0`](https://docs.phpunit.de/en/13.0/)
- [`extensions` element](https://docs.phpunit.de/en/12.0/configuration.html#the-extensions-element) on [`phpunit/phpunit:^12.0.0`](https://docs.phpunit.de/en/12.0/)
- [`extensions` element](https://docs.phpunit.de/en/11.0/configuration.html#the-extensions-element) on [`phpunit/phpunit:^11.0.0`](https://docs.phpunit.de/en/11.0/)
- [`extensions` element](https://docs.phpunit.de/en/10.5/configuration.html#the-extensions-element) on [`phpunit/phpunit:^10.0.0`](https://docs.phpunit.de/en/10.5/)

```

+
+
+

             test/Unit/

```

### Bootstrapping the extension as a PHAR

[](#bootstrapping-the-extension-as-a-phar)

To bootstrap the extension as a PHAR when using

- `phpunit/phpunit:^13.0.0`
- `phpunit/phpunit:^12.0.0`
- `phpunit/phpunit:^11.0.0`
- `phpunit/phpunit:^10.0.0`

adjust your `phpunit.xml` configuration file and configure the

- [`extensionsDirectory` attribute](https://docs.phpunit.de/en/13.0/configuration.html#the-extensionsdirectory-attribute) and the [`extensions` element](https://docs.phpunit.de/en/13.0/configuration.html#the-extensions-element) on [`phpunit/phpunit:^13.0.0`](https://docs.phpunit.de/en/13.0/)
- [`extensionsDirectory` attribute](https://docs.phpunit.de/en/12.0/configuration.html#the-extensionsdirectory-attribute) and the [`extensions` element](https://docs.phpunit.de/en/12.0/configuration.html#the-extensions-element) on [`phpunit/phpunit:^12.0.0`](https://docs.phpunit.de/en/12.0/)
- [`extensionsDirectory` attribute](https://docs.phpunit.de/en/11.0/configuration.html#the-extensionsdirectory-attribute) and the [`extensions` element](https://docs.phpunit.de/en/11.0/configuration.html#the-extensions-element) on [`phpunit/phpunit:^11.0.0`](https://docs.phpunit.de/en/11.0/)
- [`extensionsDirectory` attribute](https://docs.phpunit.de/en/10.5/configuration.html#the-extensionsdirectory-attribute) and the [`extensions` element](https://docs.phpunit.de/en/10.5/configuration.html#the-extensions-element) on [`phpunit/phpunit:^10.0.0`](https://docs.phpunit.de/en/10.5/)

```

+
+
+

             test/Unit/

```

Changelog
---------

[](#changelog)

The maintainers of this project record notable changes to this project in a [changelog](CHANGELOG.md).

Contributing
------------

[](#contributing)

The maintainers of this project suggest following the [contribution guide](.github/CONTRIBUTING.md).

Code of Conduct
---------------

[](#code-of-conduct)

The maintainers of this project ask contributors to follow the [code of conduct](.github/CODE_OF_CONDUCT.md).

General Support Policy
----------------------

[](#general-support-policy)

The maintainers of this project provide limited support.

You can support the maintenance of this project by [sponsoring @ergebnis](https://github.com/sponsors/ergebnis).

PHP Version Support Policy
--------------------------

[](#php-version-support-policy)

This project currently supports the following PHP versions:

- [PHP 8.1](https://www.php.net/releases/#8.1.0) (has reached its end of life on December 31, 2025)
- [PHP 8.2](https://www.php.net/releases/#8.2.0)
- [PHP 8.3](https://www.php.net/releases/#8.3.0)
- [PHP 8.4](https://www.php.net/releases/#8.4.0)
- [PHP 8.5](https://www.php.net/releases/#8.5.0)

The maintainers of this project add support for a PHP version following its initial release and *may* drop support for a PHP version when it has reached its [end of life](https://www.php.net/supported-versions.php).

Security Policy
---------------

[](#security-policy)

This project has a [security policy](.github/SECURITY.md).

License
-------

[](#license)

This project uses the [MIT license](LICENSE.md).

Credits
-------

[](#credits)

This package is inspired by [`nunomaduro/pao`](https://github.com/nunomaduro/pao), originally licensed under MIT by [Nuno Maduro](https://github.com/nunomaduro).

Social
------

[](#social)

Follow [@localheinz](https://twitter.com/intent/follow?screen_name=localheinz) and [@ergebnis](https://twitter.com/intent/follow?screen_name=ergebnis) on Twitter.

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance96

Actively maintained with recent releases

Popularity33

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Every ~25 days

Total

4

Last Release

32d ago

Major Versions

0.3.0 → 1.0.02026-06-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/8cabc9efd157e2b47aa5aa9830180f5ebd07813cc3e93ff1a9993b2c3d264909?d=identicon)[localheinz](/maintainers/localheinz)

---

Top Contributors

[![localheinz](https://avatars.githubusercontent.com/u/605483?v=4)](https://github.com/localheinz "localheinz (52 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (36 commits)")[![ergebnis-bot](https://avatars.githubusercontent.com/u/59560144?v=4)](https://github.com/ergebnis-bot "ergebnis-bot (34 commits)")

---

Tags

agentextensionphpphpunitreporter

###  Code Quality

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ergebnis-phpunit-agent-reporter/health.svg)

```
[![Health](https://phpackages.com/badges/ergebnis-phpunit-agent-reporter/health.svg)](https://phpackages.com/packages/ergebnis-phpunit-agent-reporter)
```

###  Alternatives

[brianium/paratest

Parallel testing for PHP

2.5k136.1M1.0k](/packages/brianium-paratest)[drupal/core-dev

require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.

2022.6M350](/packages/drupal-core-dev)[webmozarts/strict-phpunit

Enables type-safe comparisons of objects in PHPUnit

30314.4k7](/packages/webmozarts-strict-phpunit)

PHPackages © 2026

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