PHPackages                             matraux/php-benchmark - 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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. matraux/php-benchmark

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

matraux/php-benchmark
=====================

Benchmarking tool for PHP 8.4+ to measure code performance with accurate time and memory profiling.

3.0.0(2mo ago)024MITPHPPHP ^8.4CI passing

Since Mar 13Pushed 2mo agoCompare

[ Source](https://github.com/matraux/php-benchmark)[ Packagist](https://packagist.org/packages/matraux/php-benchmark)[ RSS](/packages/matraux-php-benchmark/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (13)Versions (6)Used By (0)

MATRAUX PHP Benchmark
=====================

[](#matraux-php-benchmark)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ca3e08720d92e1289103c77c493bf739fc2f1ea1e7a19642369b30488ec31439/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6174726175782f7068702d62656e63686d61726b2e7376673f6c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/matraux/php-benchmark)[![Last release](https://camo.githubusercontent.com/164f57ceef31bfe8602217ae655ca16435d1c42afb6fb8fbf9031037118779ce/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6d6174726175782f7068702d62656e63686d61726b3f646973706c61795f6e616d653d746167266c6f676f3d676974687562266c6f676f436f6c6f723d7768697465)](https://github.com/matraux/php-benchmark/releases)[![License: MIT](https://camo.githubusercontent.com/aaaf7fce1d44e884300a55df2c82406f416bc1e5009859d78aedbb69249e4611/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f6c6f676f3d6f70656e2d736f757263652d696e6974696174697665266c6f676f436f6c6f723d7768697465)](LICENSE)[![PHP](https://camo.githubusercontent.com/2b0538729bedffcc119589c18037b4ebcff0f4d71a1d4320d4904f72dda5810f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e342b2d626c75652e7376673f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://php.net)[![Security Policy](https://camo.githubusercontent.com/33427022d3760656f0ff395d8f48f1230d42ba200881fbcc019aabadf2ffabe8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53656375726974792d506f6c6963792d626c75653f6c6f676f3d62697477617264656e266c6f676f436f6c6f723d7768697465)](./.github/SECURITY.md)[![Contributing](https://camo.githubusercontent.com/bd7eaa3d90ef7ad126e208b3b8adf606e0805b6e28c8c38aa16d52fb38ac7fb5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6e747269627574696e672d44697361626c65642d6c69676874677265793f6c6f676f3d676974687562266c6f676f436f6c6f723d7768697465)](CONTRIBUTING.md)[![QA Status](https://camo.githubusercontent.com/08132ad2b4f4c961aa193d8eef3cf48905d8070c0855b21ea86f242500dca5e1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6174726175782f7068702d62656e63686d61726b2f71612e796d6c3f6c6162656c3d5175616c6974792b4173737572616e6365266c6f676f3d636865636b6d617278266c6f676f436f6c6f723d7768697465)](https://github.com/matraux/php-benchmark/actions/workflows/qa.yml)[![Issues](https://camo.githubusercontent.com/914acb5925667e8ff755f5f46f8e6bd9abfacea7748b943705fa01d8d30284e8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6d6174726175782f7068702d62656e63686d61726b3f6c6f676f3d676974687562266c6f676f436f6c6f723d7768697465)](https://github.com/matraux/php-benchmark/issues)[![Last Commit](https://camo.githubusercontent.com/0a37e5cd10f9d72cd5b442bd3869765ba0fd2b4665302896df36b484785b0ffe/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f6d6174726175782f7068702d62656e63686d61726b3f6c6f676f3d676974266c6f676f436f6c6f723d7768697465)](https://github.com/matraux/php-benchmark/commits)

Introduction
------------

[](#introduction)

Simple and precise benchmarking for PHP 8.4+. Measures execution time and memory usage of code blocks with minimal overhead.

Features
--------

[](#features)

- High-precision time and memory measurement
- Clean and readable syntax for benchmarking code blocks
- Support for named measurements and grouped runs
- Easy integration via callable or closure wrapping
- Fluent API for accessing results
- Minimal overhead, suitable for micro-benchmarking
- Native support for PHP 8.4+ features
- Integrates with Tracy for real-time benchmark visualization

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

[](#installation)

```
composer require matraux/php-benchmark
```

Requirements
------------

[](#requirements)

versionPHPnote3.0.08.4+Support PHP 8.4
Examples
--------

[](#examples)

See [Tracy](./docs/Tracy.md), [Standalone](./docs/Standalone.md) or [Console](./docs/Console.md) integration for advanced instructions.

```
use Matraux\PhpBenchmark\Benchmark\Benchmark;

$benchmark = new Benchmark;
$benchmark->label = 'Memory peak 20 MB';
$benchmark->counter = 10;
$benchmark->multiplier = 2;

$measurement = $benchmark->run(function (): string {
	return str_repeat(' ', 20 * 1024 * 1024);
});

echo $measurement->average; // Print average time (e.g. 44 ms)
echo $measurement->memory; // Print peak memory usage (e.g. 22 MB)
```

Development
-----------

[](#development)

See [Development](./docs/Development.md) for debug, test instructions, static analysis, and coding standards.

Support
-------

[](#support)

For bug reports and feature requests, please use the [issue tracker](https://github.com/matraux/php-benchmark/issues).

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance86

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community6

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

Total

5

Last Release

66d ago

Major Versions

1.3.0 → 3.0.02026-03-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/5de8dde6b301108e289df5793632663794646f600ad72d94597c78ecba7408ed?d=identicon)[matraux](/maintainers/matraux)

---

Top Contributors

[![matraux](https://avatars.githubusercontent.com/u/46919973?v=4)](https://github.com/matraux "matraux (61 commits)")

---

Tags

MATRAUXphp-benchmark

###  Code Quality

TestsCodeception

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/matraux-php-benchmark/health.svg)

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

###  Alternatives

[symfony/stopwatch

Provides a way to profile code

2.8k387.2M918](/packages/symfony-stopwatch)[fruitcake/laravel-debugbar

PHP Debugbar integration for Laravel

19.1k662.9k29](/packages/fruitcake-laravel-debugbar)[jokkedk/webgrind

Webgrind is a Xdebug profiling web frontend in PHP5. It implements a subset of the features of kcachegrind and installs in seconds and works on all platforms. For quick'n'dirty optimizations it does the job.

3.3k193.0k](/packages/jokkedk-webgrind)[koriym/printo

An object graph visualizer.

1421.8M2](/packages/koriym-printo)[soloterm/dumps

A Laravel command to intercept dumps from your Laravel application.

125285.7k3](/packages/soloterm-dumps)[beyondcode/helo-laravel

HELO Laravel debug helper

90360.1k](/packages/beyondcode-helo-laravel)

PHPackages © 2026

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