PHPackages                             phine/bench - 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. phine/bench

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

phine/bench
===========

A PHP library for running timed tests.

1.2.0(12y ago)51.0kMITPHPPHP &gt;=5.3.3

Since Aug 30Pushed 12y agoCompare

[ Source](https://github.com/kherge-archive/lib-bench)[ Packagist](https://packagist.org/packages/phine/bench)[ Docs](https://github.com/phine/lib-bench)[ RSS](/packages/phine-bench/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

Bench
=====

[](#bench)

[![Build Status](https://camo.githubusercontent.com/74e98cf25f0c231672bccb5629c6af63cfca17d3785f7ab6629bb2dfe2b07bd1/68747470733a2f2f7472617669732d63692e6f72672f7068696e652f6c69622d62656e63682e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/phine/lib-bench)[![Coverage Status](https://camo.githubusercontent.com/f3a10f20b33e293741eaa60e662234affbbde49abafb584b2438163c179a0775/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f7068696e652f6c69622d62656e63682f62616467652e706e67)](https://coveralls.io/r/phine/lib-bench)[![Latest Stable Version](https://camo.githubusercontent.com/37d10b5af992aebd22f53dc72d666e5955349b29ee9febdccb8308a161239034/68747470733a2f2f706f7365722e707567782e6f72672f7068696e652f62656e63682f762f737461626c652e706e67)](https://packagist.org/packages/phine/bench)[![Total Downloads](https://camo.githubusercontent.com/bd21e7f9d0504730ff9713fbdf685ef2265fe1b7ea1d3e059571110f951a4543/68747470733a2f2f706f7365722e707567782e6f72672f7068696e652f62656e63682f646f776e6c6f6164732e706e67)](https://packagist.org/packages/phine/bench)

Simplifies the process of creating and running benchmarks. The library self- calibrates so that the framework itself is not counted in the amount of time it takes to complete any of the tests.

Usage
-----

[](#usage)

```
use Phine\Bench\Suite;
use Phine\Bench\Test;

$suite = new Suite();

$suite[] = new Test(
    function () {
        usleep(500);
    }
);

$suite['key'] = new Test(
    function () {
        sleep(1);
    }
);

$suite['setup'] = Test::create(
    function ($sleep, $usleep) {
        sleep($sleep);
        usleep($usleep);
    }
)->setSetup(
    function () {
        return array(
            rand(0, 2),
            rand(500, 1000)
        );
    }
);

list($total, $times) = $suite->run();

echo $total, "\n";          // 3.003720998764
echo $times[0], "\n";       // 0.0012569427490234
echo $times['key'], "\n";   // 1.0002269744873
echo $times['setup'], "\n"; // 2.0022370815277
```

Requirement
-----------

[](#requirement)

- PHP &gt;= 5.3.3
- [Phine Exception](https://github.com/phine/lib-exception) &gt;= 1.0

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

[](#installation)

Via [Composer](http://getcomposer.org/):

```
$ composer require "phine/bench=~1.0"

```

Documentation
-------------

[](#documentation)

You can find the documentation in the [`docs/`](docs/) directory.

License
-------

[](#license)

This library is available under the [MIT license](LICENSE).

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity60

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 ~9 days

Total

3

Last Release

4670d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9122157?v=4)[Kevin Herrera](/maintainers/kherge)[@kherge](https://github.com/kherge)

---

Top Contributors

[![kherge](https://avatars.githubusercontent.com/u/9122157?v=4)](https://github.com/kherge "kherge (21 commits)")

---

Tags

testbenchmark

### Embed Badge

![Health badge](/badges/phine-bench/health.svg)

```
[![Health](https://phpackages.com/badges/phine-bench/health.svg)](https://phpackages.com/packages/phine-bench)
```

###  Alternatives

[mockery/mockery

Mockery is a simple yet flexible PHP mock object framework

10.7k526.2M26.5k](/packages/mockery-mockery)[hamcrest/hamcrest-php

This is the PHP port of Hamcrest Matchers

7.0k513.4M120](/packages/hamcrest-hamcrest-php)[nelmio/alice

Expressive fixtures generator

2.5k45.2M162](/packages/nelmio-alice)[zenstruck/foundry

A model factory library for creating expressive, auto-completable, on-demand dev/test fixtures with Symfony and Doctrine.

79613.7M139](/packages/zenstruck-foundry)[php-mock/php-mock

PHP-Mock can mock built-in PHP functions (e.g. time()). PHP-Mock relies on PHP's namespace fallback policy. No further extension is needed.

37419.9M122](/packages/php-mock-php-mock)[brain/monkey

Mocking utility for PHP functions and WordPress plugin API

34214.3M462](/packages/brain-monkey)

PHPackages © 2026

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