PHPackages                             stk2k/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. stk2k/bench

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

stk2k/bench
===========

Simple benchmark classes

0.2.1(5y ago)01.2k2MITPHPPHP &gt;=7.2CI failing

Since Nov 19Pushed 5y ago1 watchersCompare

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

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

Simple benchmark classes
========================

[](#simple-benchmark-classes)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1198a8e192955f2b37e7f36872916158aafd976e94cf55e275336644a52ef6f4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73746b326b2f62656e63682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stk2k/bench)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/053c7a1869cf6fe8243d68aa899285da2fa9e84b822622028edf42f7634aaa90/68747470733a2f2f7472617669732d63692e6f72672f73746b326b2f62656e63682e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/stk2k/bench)[![Coverage Status](https://camo.githubusercontent.com/56e34307de87655575f0bbfdbc73ad3540f2b7b305532e18d2bf0e77d6ddd449/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f73746b326b2f62656e63682f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/stk2k/bench?branch=master)[![Code Climate](https://camo.githubusercontent.com/f70fca809c9bdb95d803e8c21d06e6ea0147cfe0becfbf01d28e46706bc36703/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f73746b326b2f62656e63682f6261646765732f6770612e737667)](https://codeclimate.com/github/stk2k/bench)[![Total Downloads](https://camo.githubusercontent.com/a6a58ab0ca0227ddf5bbd5a1f8ce706734b74a38acfc6f1099df72f7bddaa3d1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73746b326b2f62656e63682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stk2k/bench)

Description
-----------

[](#description)

Simple benchmark classes

Feature
-------

[](#feature)

Demo
----

[](#demo)

### Exsample 1: time benchmark shorthand

[](#exsample-1-time-benchmark-shorthand)

```
use Stk2k\Bench\TimeBenchmark;

$handle = TimeBenchmark::start();

// benchmark target code here

$score = TimeBenchmark::score($handle);
echo 'score: ' . $score . ' msec';
```

### Exsample 2: memory benchmark shorthand

[](#exsample-2-memory-benchmark-shorthand)

```
use Stk2k\Bench\MemoryBenchmark;

$handle = MemoryBenchmark::start();

// benchmark target code here

$score = MemoryBenchmark::score($handle);
$score = array_map(function($v){ return $v . 'MB'; }, $score);
echo 'score: ' . print_r($score, true);
```

Usage
-----

[](#usage)

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

[](#requirement)

PHP 7.2 or later

Installing stk2k/bench
----------------------

[](#installing-stk2kbench)

The recommended way to install stk2k/bench is through [Composer](http://getcomposer.org).

```
composer require stk2k/bench
```

After installing, you need to require Composer's autoloader:

```
require 'vendor/autoload.php';
```

License
-------

[](#license)

[MIT](https://github.com/stk2k/bench/blob/master/LICENSE)

Author
------

[](#author)

[stk2k](https://github.com/stk2k)

Disclaimer
----------

[](#disclaimer)

This software is no warranty.

We are not responsible for any results caused by the use of this software.

Please use the responsibility of the your self.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity45

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

Total

3

Last Release

1853d ago

PHP version history (2 changes)0.1.0PHP &gt;=7.1

0.2.0PHP &gt;=7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/985640?v=4)[stk2k](/maintainers/stk2k)[@stk2k](https://github.com/stk2k)

---

Top Contributors

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

---

Tags

phpbenchmark

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[christophrumpel/artisan-benchmark

Benchmark Artisan Commands

18388.5k](/packages/christophrumpel-artisan-benchmark)[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21623.4k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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