PHPackages                             sergekukharev/phpunit-fasttrap - 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. sergekukharev/phpunit-fasttrap

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

sergekukharev/phpunit-fasttrap
==============================

Find slow tests in your PHPUnit test suite

1.0.0(10y ago)030MITPHPPHP &gt;=5.3.0

Since Oct 27Pushed 10y ago1 watchersCompare

[ Source](https://github.com/sergekukharev/phpunit-fasttrap)[ Packagist](https://packagist.org/packages/sergekukharev/phpunit-fasttrap)[ Docs](https://github.com/sergekukharev/phpunit-speedtrap)[ RSS](/packages/sergekukharev-phpunit-fasttrap/feed)WikiDiscussions master Synced 1mo ago

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

phpunit-fasttrap
================

[](#phpunit-fasttrap)

FastTrap reports on fast-running tests in your PHPUnit test suite right in your console.

Typical usage of it - you need to separate integration tests from unit tests mixed in together. Main benefit of unit test is his speed, so you can detect most of the unit tests between integration by adding this listener.

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

[](#installation)

FastTrap is installable via [Composer](http://getcomposer.org) and should be added as a `require-dev` dependency:

```
composer require --dev sergekukharev/phpunit-fasttrap

```

Usage
-----

[](#usage)

Enable with all defaults by adding the following to your test suite's `phpunit.xml` file:

```

...

```

Now run your test suite as normal. If tests run that do not exceed threshold (500ms by default), FastTrap will report on them in the console after the suite completes.

Configuration
-------------

[](#configuration)

FastTrap has two configurable parameters:

- **fastThreshold** - Number of milliseconds a test takes to execute before being considered "fast" (Default: 500ms)
- **reportLength** - Number of fast tests included in the report (Default: 10 tests)

These configuration parameters are set in `phpunit.xml` when adding the listener:

```

                        500

                        100

```

This allows you to set your own criteria for "fast" tests, and how many you care to know about.

Custom fast threshold per-test method
-------------------------------------

[](#custom-fast-threshold-per-test-method)

You may have a few tests in your suite that take a little bit longer to run, and want to have a higher fast threshold than the rest of your suite.

You can use the annotation `@fastThreshold` to set a custom fast threshold on a per-test method basis. This number can be higher or lower than the default threshold and will be used in place of the default threshold for that specific test.

```
class SomeTestCase extends \PHPUnit_Framework_TestCase
{
    /**
     * @fastThreshold 5000
     */
    public function testLongRunningProcess()
    {
        // Code to exercise your long-running SUT
    }
}
```

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

[](#inspiration)

This project was inspired by and forked from John Kary's SpeedTrap. There is only one differences between those two - Fast trap is able to detect fast tests.

SpeedTrap project itself was inspired by Rspec's `-p` option that displays feedback about fast tests.

License
-------

[](#license)

phpunit-fasttrap is available under the MIT License.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

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

3857d ago

### Community

Maintainers

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

---

Top Contributors

[![johnkary](https://avatars.githubusercontent.com/u/135607?v=4)](https://github.com/johnkary "johnkary (24 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (2 commits)")[![jakeasmith](https://avatars.githubusercontent.com/u/234832?v=4)](https://github.com/jakeasmith "jakeasmith (1 commits)")[![mihaeu](https://avatars.githubusercontent.com/u/2168701?v=4)](https://github.com/mihaeu "mihaeu (1 commits)")

---

Tags

phpunitfastprofile

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sergekukharev-phpunit-fasttrap/health.svg)

```
[![Health](https://phpackages.com/badges/sergekukharev-phpunit-fasttrap/health.svg)](https://phpackages.com/packages/sergekukharev-phpunit-fasttrap)
```

###  Alternatives

[phpunit/phpunit

The PHP Unit Testing framework.

20.0k910.7M134.8k](/packages/phpunit-phpunit)[johnkary/phpunit-speedtrap

Find and report on slow tests in your PHPUnit test suite

78337.2M122](/packages/johnkary-phpunit-speedtrap)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[spatie/phpunit-snapshot-assertions

Snapshot testing with PHPUnit

69617.9M510](/packages/spatie-phpunit-snapshot-assertions)[dg/bypass-finals

Removes final keyword from source code on-the-fly and allows mocking of final methods and classes

57026.3M456](/packages/dg-bypass-finals)[mybuilder/phpunit-accelerator

PHPUnit accelerator

1363.0M38](/packages/mybuilder-phpunit-accelerator)

PHPackages © 2026

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