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

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

wdalmut/php-bench
=================

Benchmark your application methods in a simple way

0.1.2(10y ago)577[1 issues](https://github.com/wdalmut/php-bench/issues)2MITPHP

Since Oct 24Pushed 10y agoCompare

[ Source](https://github.com/wdalmut/php-bench)[ Packagist](https://packagist.org/packages/wdalmut/php-bench)[ RSS](/packages/wdalmut-php-bench/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (3)Versions (4)Used By (2)

Benchmark your class methods or functions
=========================================

[](#benchmark-your-class-methods-or-functions)

[![Build Status](https://camo.githubusercontent.com/1677992f053cabebe0805941113bd02064ad7826305f16a9e7be5e72ba55f415/68747470733a2f2f7472617669732d63692e6f72672f7764616c6d75742f7068702d62656e63682e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/wdalmut/php-bench)

Just a simple way to benchmark your class methods or functions.

```
./vendor/bin/bench run tests/
```

or with different paths

```
./vendor/bin/bench run tests/ benchs/
```

Declare a bench method
----------------------

[](#declare-a-bench-method)

Just create a method in a class starting with the `benchmark` keyword or use a simple `@benchmark` annotation in your doc-block.

```
class MyClass
{
    ...

    public function benchmarkUsingTheMethodName($b)
    {
        for ($i=0; $itimes(); $i++) {
            my_project_function("%s", "hello");
        }
    }

    /**
     * @benchmark
     */
    public function this_bench_instead_use_the_annotation($b) {
        for ($i=0; $itimes(); $i++) {
            $myObj->slowMethod("stub");
        }
    }
}
```

The `benchmark` method receive an object `b` from outside that contains the number of iterations that your bench function should run.

PHPUnit integration
-------------------

[](#phpunit-integration)

Just add a `benchmark` method in your testcases.

```
class MyTest extends \PHPUnit_Framework_TestCase
{
    // Executed only by php-bench
    public function benchmarkMyAppMethod($b)
    {
        for ($iassertEquals(...);
    }
}
```

Install with composer
---------------------

[](#install-with-composer)

You can use composer in order to get this library locally

```
{
    "require-dev": {
        "wdalmut/php-bench": "*"
    }
}
```

Inspired by Golang benchmark library

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

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

Total

3

Last Release

3905d ago

### Community

Maintainers

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

---

Top Contributors

[![wdalmut](https://avatars.githubusercontent.com/u/551974?v=4)](https://github.com/wdalmut "wdalmut (20 commits)")

---

Tags

testingphpunitbenchmarkbench

### Embed Badge

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

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

###  Alternatives

[brianium/paratest

Parallel testing for PHP

2.5k136.1M985](/packages/brianium-paratest)[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k28.9M2.4k](/packages/infection-infection)[phpbench/phpbench

PHP Benchmarking Framework

2.0k14.6M847](/packages/phpbench-phpbench)[testo/testo

A lightweight PHP testing framework.

1959.3k55](/packages/testo-testo)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

103519.9k53](/packages/friendsoftypo3-content-blocks)[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15312.0M36](/packages/magento-magento2-functional-testing-framework)

PHPackages © 2026

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