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

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

asad/benchmark
==============

Micro PHP library for benchmarking

1.0.5(6y ago)02.5kMITPHPPHP ^7.0

Since May 9Pushed 6y ago1 watchersCompare

[ Source](https://github.com/asadku34/benchmark)[ Packagist](https://packagist.org/packages/asad/benchmark)[ RSS](/packages/asad-benchmark/feed)WikiDiscussions master Synced 3w ago

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

Benchmark you php script with this Micro Library.
=================================================

[](#benchmark-you-php-script-with-this-micro-library)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2e105d34e0672b7cfe536d95e179451cf71fe889b125e101a7b44eb3ea2567ee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f617361642f62656e63686d61726b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/asad/benchmark)[![Build Status](https://camo.githubusercontent.com/de896ece5f9e6425ef62c00d6ee8f8ca2d0a24b27c7b7d01a6f02a391e1fa36d/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f617361646b7533342f62656e63686d61726b2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/asadku34/benchmark)[![Quality Score](https://camo.githubusercontent.com/b61557405cc2f6ab6c84e2515fe0205ebb3924a8167824076e3539b3116bfeec/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f617361646b7533342f62656e63686d61726b2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/asadku34/benchmark)[![Total Downloads](https://camo.githubusercontent.com/1ee41ae3ae11cedad9f5b1438caf5112afd9694d384f3b69c80c2a28480e3f1c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f617361642f62656e63686d61726b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/asad/benchmark)[![License](https://camo.githubusercontent.com/850eae1099d2b05f53383473d7cd51f9bc1ab09b7d0d9e5122f1dd930efdcc6d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6173686170652f6170697374617475732e737667)](https://packagist.org/packages/asad/benchmark)

This package only for the Laravel App. If you want to use this package in non-laravel App then use this [Ubench](https://github.com/devster/ubench)

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

[](#requirements)

- [Laravel 5.\*](https://laravel.com/docs/5.0#server-requirements)

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

[](#installation)

You can install the package via composer:

```
composer require asad/benchmark
```

Usage
-----

[](#usage)

```
use Asad\Bench\Benchmark;

$bench = new Benchmark();

$bench->start();

// Execute some code

$bench->end();

// Get elapsed time and memory
echo $bench->getTime(); // 156ms or 1.123s
echo $bench->getTime(true); // elapsed microtime in float
echo $bench->getTime(false, '%d%s'); // 156ms or 1s

echo $bench->getMemoryPeak(); // 152B or 90.00Kb or 15.23Mb
echo $bench->getMemoryPeak(true); // memory peak in bytes
echo $bench->getMemoryPeak(false, '%.3f%s'); // 152B or 90.152Kb or 15.234Mb

// Returns the memory usage at the end mark
echo $bench->getMemoryUsage(); // 152B or 90.00Kb or 15.23Mb

// Accepts a callable as the first parameter.  Any additional parameters will be passed to the callable.
$result = $bench->run(function ($x) {
    return $x;
}, 1);
echo $bench->getTime();
```

### Facade

[](#facade)

If you don't want to use [new](https://www.php.net/manual/en/language.types.object.php) keyword then use Facade.

```
use Asad\Bench\BFacade;

BFacade::start();
// Execute some code
BFacade::end();

echo BFacade::getTime();
echo BFacade::getMemoryPeak(true);
```

### Testing

[](#testing)

```
composer run test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

This Micro Framework developed by [Devster](https://github.com/devster/ubench). I'm the person who converted it to the Laravel package.

- [Devster](https://github.com/devster/ubench)
- [Asadur Rahman](https://github.com/asadku34)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

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

6

Last Release

2236d ago

PHP version history (3 changes)1.0.0PHP ^7.1

1.0.2PHP ^5.6|^7.0

1.0.5PHP ^7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2770949?v=4)[Sk Asadur Rahman](/maintainers/asadku34)[@asadku34](https://github.com/asadku34)

---

Tags

laravelbenchmarkasadubenchdevster

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[christophrumpel/artisan-benchmark

Benchmark Artisan Commands

18380.9k](/packages/christophrumpel-artisan-benchmark)[janiaje/benchmark

Benchmark package.

1688.5k](/packages/janiaje-benchmark)[stephenjude/filament-blog

Filament Blog Builder

20518.8k](/packages/stephenjude-filament-blog)[datomatic/nova-detached-actions

A Laravel Nova tool to allow for placing actions in the Nova toolbar detached from the checkbox selection mechanism.

11258.1k](/packages/datomatic-nova-detached-actions)

PHPackages © 2026

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