PHPackages                             riod94/profiler-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. riod94/profiler-benchmark

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

riod94/profiler-benchmark
=========================

PHP Laravel simple and lightweight profiler and benchmarking

v1.1.1(2y ago)120.1k↑46.3%MITPHPPHP &gt;=5.6

Since Oct 14Pushed 2y ago1 watchersCompare

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

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

Profiler Benchmark
==================

[](#profiler-benchmark)

[![License](https://camo.githubusercontent.com/af80f3e57f1b2b64d05b6d75ff7facea6a2d20a4caab5897f22817af6e25273f/687474703a2f2f706f7365722e707567782e6f72672f72696f6439342f70726f66696c65722d62656e63686d61726b2f6c6963656e7365)](https://packagist.org/packages/riod94/profiler-benchmark)[![Latest Stable Version](https://camo.githubusercontent.com/20ec0dedf2773d672ec737513fa768dc096da23d3f711b0d4b3ad98c9cff2e5b/687474703a2f2f706f7365722e707567782e6f72672f72696f6439342f70726f66696c65722d62656e63686d61726b2f76)](https://packagist.org/packages/riod94/profiler-benchmark)[![Total Downloads](https://camo.githubusercontent.com/dac5a2cb1fa250e91e628588e7e2de490ebe1825cd443708aaea006d368a6b2e/687474703a2f2f706f7365722e707567782e6f72672f72696f6439342f70726f66696c65722d62656e63686d61726b2f646f776e6c6f616473)](https://packagist.org/packages/riod94/profiler-benchmark)[![PHP Version Require](https://camo.githubusercontent.com/242b24b68dd8dab93d0ebb629e98770b392d7c3053dd2e3d62fdf1253c47d1ce/687474703a2f2f706f7365722e707567782e6f72672f72696f6439342f70726f66696c65722d62656e63686d61726b2f726571756972652f706870)](https://packagist.org/packages/riod94/profiler-benchmark)[![Codacy Badge](https://camo.githubusercontent.com/3c8af1418f2b0c5ecaba0afa9f8b696668e517b26dd1c3d06220827224f139f4/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3330393339303031333066313461323139613136386162623533306232613963)](https://app.codacy.com/gh/riod94/profiler-benchmark/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)

The ProfilerBenchmark library is used for benchmarking and profiling Laravel code. It is used to measure the performance of code. It is a simple and lightweight library.

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

[](#installation)

You can install this library using Composer. Run the following command in the terminal:

```
composer require riod94/profiler-benchmark
```

This package register the provider automatically, [See laravel package discover](https://laravel.com/docs/10.x/packages#package-discovery).

Usage
-----

[](#usage)

Here is an example of how to use the ProfilerBenchmark library:

```
use Riod94\ProfilerBenchmark\ProfilerBenchmark;

// Disable ProfilerBenchmark if your code running in production
ProfilerBenchmark::enabled(env('APP_ENV') !== 'production');

// Start benchmarking
ProfilerBenchmark::start('initialize');

// Benchmark steps
// Your Code Here
ProfilerBenchmark::checkpoint('Get start product list');

// Your Code Here
ProfilerBenchmark::checkpoint('Parse product list');
// Your Code Here

// Get benchmark results
$benchmarkData = ProfilerBenchmark::getBenchmark('Finish');

// Display benchmark results
var_dump($benchmarkData);

// Example of $benchmarkData result
array:6 [
  "total_time" => 0.02
  "total_memory" => "24.02 MB"
  "average_memory" => "15.01 MB"
  "min_memory" => "8 MB"
  "max_memory" => "24.02 MB"
  "steps" => array:4 [
    0 => array:3 [
      "label" => "initialize"
      "time" => 0.0
      "memory" => "8 MB"
    ]
    1 => array:3 [
      "label" => "Get start product list"
      "time" => 0.01
      "memory" => "12.02 MB"
    ]
    2 => array:3 [
      "label" => "Parse product list"
      "time" => 0.01
      "memory" => "16.02 MB"
    ]
    3 => array:3 [
      "label" => "Finish"
      "time" => 0.02
      "memory" => "24.02 MB"
    ]
  ]
]

// Set show function, show return and show arguments
ProfilerBenchmark::setShowFunction(true);
ProfilerBenchmark::setShowReturn(false);
ProfilerBenchmark::setShowArgs(false);

// Profile and benchmark a function
$profileData = ProfilerBenchmark::functionBenchmark(function() {
    // Code of the function to profile and benchmark
}, 9999, $args);

// Display benchmark results and profile data
var_dump($profileData);

// Example of $profileData result
array:8 [
  "iterations" => 9999
  "total_time" => 1.08
  "average_time" => 0.0
  "min_time" => 0.0
  "max_time" => 0.0
  "function" => Closure()^ {#451
    class: "Riod94\ProfilerBenchmark\Tests\ProfilerBenchmarkTest"
    this: Riod94\ProfilerBenchmark\Tests\ProfilerBenchmarkTest {#314 …}
  }
  "args" => null
  "return" => null
]

// OR you can benchmark a function of a class with arguments
$profileData1 = ProfilerBenchmark::functionBenchmark([BankAccount::class, 'getBalance'], 100, $args);

// Display benchmark results and profile data
var_dump($profileData1);

// Example of $profileData1 result
array:8 [
  "iterations" => 100
  "total_time" => 1.00
  "average_time" => 0.0
  "min_time" => 0.0
  "max_time" => 0.0
  "function" => array:2 [
    0 => "BankAccount"
    1 => "getBalance"
  ]
  "args" => null
  "return" => null
]
```

That's it! enjoy :D.

### Testing

[](#testing)

```
vendor/bin/phpunit tests
```

### Changelog

[](#changelog)

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

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

[](#contributing)

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

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [riod94](https://github.com/riod94)

License
-------

[](#license)

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

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity41

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

Total

5

Last Release

924d ago

### Community

Maintainers

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

---

Tags

phplaravelprofilerprofilingtimerbenchmarkingbenchmark

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[laracraft-tech/laravel-xhprof

Easy XHProf setup to profile your laravel application!

235321.4k](/packages/laracraft-tech-laravel-xhprof)[bavix/laravel-xhprof

Quick profiling of your code for Laravel

22156.6k](/packages/bavix-laravel-xhprof)[recca0120/laravel-tracy

A Laravel Package to integrate Nette Tracy Debugger

388283.0k3](/packages/recca0120-laravel-tracy)[lsrur/inspector

Laravel Inspector, debugging and profiling tools for Web Artisans

23441.1k](/packages/lsrur-inspector)[daylerees/anbu

The Anbu profiler for Laravel 4.

3054.9k](/packages/daylerees-anbu)[sandstorm/plumber

Profiling Toolkit for Neos Flow and Neos

384.9k](/packages/sandstorm-plumber)

PHPackages © 2026

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