PHPackages                             jclaveau/phpunit-profile-asserts - 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. jclaveau/phpunit-profile-asserts

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

jclaveau/phpunit-profile-asserts
================================

Provides asserts against memory usage and execution time for PHPUnit

1.2.0(2mo ago)21.5k1[1 issues](https://github.com/jclaveau/phpunit-profile-asserts/issues)2MITPHPPHP ^8.0CI failing

Since Jul 13Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/jclaveau/phpunit-profile-asserts)[ Packagist](https://packagist.org/packages/jclaveau/phpunit-profile-asserts)[ Docs](https://github.com/jclaveau/phpunit-profile-asserts)[ RSS](/packages/jclaveau-phpunit-profile-asserts/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (2)Versions (6)Used By (2)

phpunit-profile-asserts
=======================

[](#phpunit-profile-asserts)

This lib provides asserts against execution time and memory usage. It also provides a StopwatchListener based on the Stopwatch component of Symfony.

[![Tests](https://github.com/jclaveau/phpunit-profile-asserts/actions/workflows/tests.yml/badge.svg)](https://github.com/jclaveau/phpunit-profile-asserts/actions/workflows/tests.yml)

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

[](#installation)

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

```
composer require --dev jclaveau/phpunit-profile-asserts

```

Usage
-----

[](#usage)

Enable by adding the following code to your project's `phpunit.xml` file:

```

...

```

```
class SomeTestCase extends \PHPUnit_Framework_TestCase
{
    use \JClaveau\PHPUnit\Framework\UsageConstraintTrait; // adds the asserts methods

    /**
     */
    public function test_usages()
    {
        // ...

        $this->assertExecutionTimeBelow(1.5); // seconds
        $this->assertMemoryUsageBelow('1M');

        // This trait also provides two methods to help knowing the current
        // memory usage and duration
        $this->getMemoryUsage();
        $this->getExecutionTime();
    }

}
```

TODO
----

[](#todo)

- Integrate SpeedTrap and adds MemoryTrap
- Investigate xhprof integration and asserts on number of calls / execution time of specific methods/functions

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

[](#inspiration)

- [https://github.com/usernam3/phpunit\_stopwatch\_annotations](https://github.com/usernam3/phpunit_stopwatch_annotations)
-

License
-------

[](#license)

phpunit-profile-asserts is available under the MIT License.

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance76

Regular maintenance activity

Popularity19

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity71

Established project with proven stability

 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

Every ~1396 days

Total

3

Last Release

66d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.6

1.2.0PHP ^8.0

### Community

Maintainers

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

---

Top Contributors

[![jclaveau](https://avatars.githubusercontent.com/u/1556489?v=4)](https://github.com/jclaveau "jclaveau (8 commits)")

---

Tags

phpunitassertprofile

### Embed Badge

![Health badge](/badges/jclaveau-phpunit-profile-asserts/health.svg)

```
[![Health](https://phpackages.com/badges/jclaveau-phpunit-profile-asserts/health.svg)](https://phpackages.com/packages/jclaveau-phpunit-profile-asserts)
```

###  Alternatives

[brianium/paratest

Parallel testing for PHP

2.5k118.8M753](/packages/brianium-paratest)[johnkary/phpunit-speedtrap

Find and report on slow tests in your PHPUnit test suite

78137.2M121](/packages/johnkary-phpunit-speedtrap)[spatie/phpunit-snapshot-assertions

Snapshot testing with PHPUnit

69417.9M511](/packages/spatie-phpunit-snapshot-assertions)[ergebnis/phpunit-slow-test-detector

Provides facilities for detecting slow tests in phpunit/phpunit.

1468.1M72](/packages/ergebnis-phpunit-slow-test-detector)[facile-it/paraunit

paraunit

146721.6k11](/packages/facile-it-paraunit)[lmc/steward

Steward - makes Selenium WebDriver + PHPUnit testing easy and robust

222163.1k1](/packages/lmc-steward)

PHPackages © 2026

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