PHPackages                             scriptfusion/phpunit-immediate-exception-printer - 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. scriptfusion/phpunit-immediate-exception-printer

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

scriptfusion/phpunit-immediate-exception-printer
================================================

Immediately prints exceptions and assertion failures during testing.

3.6.0(2mo ago)4978.0k↑300%10[2 issues](https://github.com/ScriptFUSION/Pip/issues)15LGPL-3.0-onlyPHPPHP &gt;=8.1CI passing

Since Mar 6Pushed 2mo ago4 watchersCompare

[ Source](https://github.com/ScriptFUSION/Pip)[ Packagist](https://packagist.org/packages/scriptfusion/phpunit-immediate-exception-printer)[ RSS](/packages/scriptfusion-phpunit-immediate-exception-printer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (16)Used By (15)

[![Pip](doc/images/logo.webp)](doc/images/logo.webp)

[![Latest version](https://camo.githubusercontent.com/390ed8c59e2efd8483a2e8729ec3e824acd70f49b8bde918df559c7c3cef9f5d/68747470733a2f2f706f7365722e707567782e6f72672f736372697074667573696f6e2f7069702f76657273696f6e "Latest version")](https://github.com/ScriptFUSION/PHPUnit-Immediate-Printer/releases)[![Total downloads](https://camo.githubusercontent.com/f796e65ec82f3b37643ae2e834be2beca294f198fa39aa0cd213a99a15482668/68747470733a2f2f706f7365722e707567782e6f72672f736372697074667573696f6e2f7069702f646f776e6c6f616473 "Total downloads")](https://packagist.org/packages/scriptfusion/pip)[![Build status](https://github.com/ScriptFUSION/PHPUnit-Immediate-Printer/actions/workflows/Tests.yaml/badge.svg "Build status")](https://github.com/ScriptFUSION/PHPUnit-Immediate-Printer/actions/workflows/Tests.yaml)[![Test coverage](https://camo.githubusercontent.com/9f0914fed806e9ed512f96e3c58aec06e004e08e6bfcf219744f867b058ffab7/68747470733a2f2f636f6465636f762e696f2f6769746875622f536372697074465553494f4e2f504850556e69742d496d6d6564696174652d5072696e7465722f67726170682f62616467652e737667 "Test coverage")](https://codecov.io/gh/ScriptFUSION/PHPUnit-Immediate-Printer)

PHPUnit Immediate Printer
=========================

[](#phpunit-immediate-printer)

Pip is a [PHPUnit](https://github.com/sebastianbergmann/phpunit) extension that immediately prints exceptions and assertion failures during a test run. Normally PHPUnit keeps failure details secret until the end of the test run, but sometimes we don't want to wait that long. With Pip, all secrets are immediately revealed, with a few extra benefits, too.

Benefits
--------

[](#benefits)

- Display the name of each test case as it is executed.
- Display the execution time of each test in configurable, tiered colour bands.
- Immediately print exceptions, assertion failures, warnings, notice and deprecation messages as they occur.
- Flawless test suite indicator: success dot turns to red exclamation mark if any prior tests failed. Useful for CI consoles without a scrollback buffer.

Preview
-------

[](#preview)

The following preview is somewhat atypical but shows all supported output cases at once. Of course, we expect all *your* tests to be mostly green!

[![Preview image](doc/images/test%20run%203.4.webp)](doc/images/test%20run%203.4.webp)

Pip makes no attempt to modify the test summary; only runtime output is changed.

Usage
-----

[](#usage)

1. Add the dependency to your Composer file's `require-dev` section.

    ```
    composer require --dev scriptfusion/pip
    ```
2. Declare the printer extension in your `phpunit.xml` configuration file.

    ```

    ```
3. Run the tests!

    ```
    vendor/bin/phpunit
    ```
4. Enjoy immediate test execution feedback.

### Configuration

[](#configuration)

Pip's behaviour can be customized by adding `` nodes as children of the `` node in `phpunit.xml`, with `name` and `value` attributes corresponding to the table below.

Parameter nameDefault valueDescriptionperf.slow200 (ms)Sets the performance threshold for *slow* (yellow) tests.perf.vslow1000 (ms)Sets the performance threshold for *very slow* (red) tests.test.dp.argstrueTrue to show the arguments passed by the data provider, false to hide.test.name.strip''Strips the specified matching portion of the test name.Requirements
------------

[](#requirements)

Pip versionPHPUnit versionsMinimum PHP version310 / 11 / 12 / 138.1 / 8.2 / 8.3 / 8.42*yanked*-15 / 65.6 / 7.0Testing Pip
-----------

[](#testing-pip)

To run the full test suite, use the following command.

```
composer test
```

Pip's capabilities are exploited via `CapabilitiesTest`. However, this test file isn't run directly because many of these tests are designed to fail. Instead, we write tests that run PHPUnit internally, each of which invokes one of the capability test cases and verifies its output. To run `CapabilitiesTest`, specify the following command

```
composer test test/CapabilitiesTest.php
```

The real tests, also known as *functional tests*, are located in `test/functional`, written in PHPT format. PHPT is a [scarcely documented format](http://qa.php.net/phpt_details.php) designed to support [testing PHP itself](https://qa.php.net/write-test.php). An undocumented feature of PHPUnit is its limited support for a subset of the PHPT test specification, which we exploit to test PHPUnit itself with our printer implementation loaded.

### Writing functional tests

[](#writing-functional-tests)

To test the output of a particular capability we run `CapabilitiesTest` with the `--filter` option to target a specific test case. Each functional test contains the arguments passed to PHPUnit in the `--ARGS--` section of the file. These arguments can be pasted directly after the PHPUnit command to see the resulting output from that test case. We verify the output in the `--EXPECTF--` section of the file.

One challenge we must overcome is verifying coloured output including ANSI escape sequences. To see these escape sequences we can pipe the output of a specific capability test to `cat -v` as shown in the following example.

```
vendor/bin/phpunit -c test --colors=always test/CapabilitiesTest.php --filter ::testSuccess$ | cat -v
```

The output from `cat` will print the "escape" character as `^[`. We must replace each occurrence of this character sequence with the literal escape character (ASCII character 27). The easiest way to obtain the real escape character is to just copy it from an existing functional test.

Create a new functional test by copying an existing test as a template, then modify the PHPUnit arguments and the expected output to match what we expect using the techniques just described. Don't forget to give the test a clear description in the `--TEST--` section!

Inspiration
-----------

[](#inspiration)

Thanks to the following open source projects that inspired this project.

- [diablomedia/phpunit-pretty-printer](https://github.com/diablomedia/phpunit-pretty-printer) – Design and implementation.
- [whatthejeff/nyancat-phpunit-resultprinter](https://github.com/whatthejeff/nyancat-phpunit-resultprinter) – Testing.
- [skyzyx/phpunit-result-printer](https://github.com/skyzyx/phpunit-result-printer) – Design.

###  Health Score

63

—

FairBetter than 99% of packages

Maintenance86

Actively maintained with recent releases

Popularity44

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

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

Every ~235 days

Recently: every ~148 days

Total

15

Last Release

69d ago

Major Versions

1.3.0 → 2.0.02017-08-16

2.0.0 → 3.0.02024-07-20

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/470626?v=4)[Bilge](/maintainers/Bilge)[@Bilge](https://github.com/Bilge)

---

Top Contributors

[![Bilge](https://avatars.githubusercontent.com/u/470626?v=4)](https://github.com/Bilge "Bilge (34 commits)")[![kAlvaro](https://avatars.githubusercontent.com/u/1327350?v=4)](https://github.com/kAlvaro "kAlvaro (2 commits)")[![ireneperezddc1](https://avatars.githubusercontent.com/u/88267366?v=4)](https://github.com/ireneperezddc1 "ireneperezddc1 (1 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

---

Tags

exception-printerphpunitphpunit-printertesting

### Embed Badge

![Health badge](/badges/scriptfusion-phpunit-immediate-exception-printer/health.svg)

```
[![Health](https://phpackages.com/badges/scriptfusion-phpunit-immediate-exception-printer/health.svg)](https://phpackages.com/packages/scriptfusion-phpunit-immediate-exception-printer)
```

###  Alternatives

[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[timacdonald/log-fake

A drop in fake logger for testing with the Laravel framework.

4235.9M56](/packages/timacdonald-log-fake)[jasonmccreary/laravel-test-assertions

A set of helpful assertions when testing Laravel applications.

3513.9M32](/packages/jasonmccreary-laravel-test-assertions)[ergebnis/phpunit-slow-test-detector

Provides facilities for detecting slow tests in phpunit/phpunit.

1468.1M72](/packages/ergebnis-phpunit-slow-test-detector)[typo3/testing-framework

The TYPO3 testing framework provides base classes for unit, functional and acceptance testing.

675.0M775](/packages/typo3-testing-framework)[robiningelbrecht/phpunit-pretty-print

Prettify PHPUnit output

76460.0k15](/packages/robiningelbrecht-phpunit-pretty-print)

PHPackages © 2026

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