PHPackages                             initphp/performance-meter - 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. initphp/performance-meter

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

initphp/performance-meter
=========================

Zero-dependency, single-file PHP profiler for measuring elapsed time and memory usage between named checkpoints.

2.0.0(1mo ago)14811MITPHPPHP ^8.1CI passing

Since Mar 15Pushed 3w ago1 watchersCompare

[ Source](https://github.com/InitPHP/PerformanceMeter)[ Packagist](https://packagist.org/packages/initphp/performance-meter)[ RSS](/packages/initphp-performance-meter/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (3)Versions (6)Used By (1)

InitPHP PerformanceMeter
========================

[](#initphp-performancemeter)

A zero-dependency, single-class PHP profiler for measuring elapsed time and memory usage between named checkpoints.

[![CI](https://github.com/InitPHP/PerformanceMeter/actions/workflows/ci.yml/badge.svg)](https://github.com/InitPHP/PerformanceMeter/actions/workflows/ci.yml)[![Latest Stable Version](https://camo.githubusercontent.com/0c9ba7ae53048fabcca1bba935cd9d7336c4161aff7dea0dc7c22787960478fd/68747470733a2f2f706f7365722e707567782e6f72672f696e69747068702f706572666f726d616e63652d6d657465722f76)](https://packagist.org/packages/initphp/performance-meter)[![Total Downloads](https://camo.githubusercontent.com/8dc5d58786e45dc41be59014ccb2fa934bc6be12e25995572b2d3e7ff84a3ce0/68747470733a2f2f706f7365722e707567782e6f72672f696e69747068702f706572666f726d616e63652d6d657465722f646f776e6c6f616473)](https://packagist.org/packages/initphp/performance-meter)[![License](https://camo.githubusercontent.com/1fdc501ec3fdc917ad069f2a975bd4d51f1ae047ad565e3b9c6a1252247549b5/68747470733a2f2f706f7365722e707567782e6f72672f696e69747068702f706572666f726d616e63652d6d657465722f6c6963656e7365)](https://packagist.org/packages/initphp/performance-meter)[![PHP Version Require](https://camo.githubusercontent.com/1214ccd1a7746e794b77667d62e6d0c12e35eb9dc7d6f158efdb8a63abe94a02/68747470733a2f2f706f7365722e707567782e6f72672f696e69747068702f706572666f726d616e63652d6d657465722f726571756972652f706870)](https://packagist.org/packages/initphp/performance-meter)

Positioning
-----------

[](#positioning)

PerformanceMeter is intentionally minimal — a single `final` class with a handful of static methods that works without any other dependency. It exists to fill a specific niche:

> Quick, single-file timing checks where pulling in a full profiling library would be overkill.

It is **not** a replacement for full-featured profilers; it is the cheapest possible thing that lets you answer *"how long did this block take and how much memory did it use?"*.

### When to use this

[](#when-to-use-this)

- One-off benchmarking scripts and microbenchmarks
- CLI tools and cron jobs where you want a quick elapsed-time print at the end
- Tutorial / educational code where introducing a heavier dependency would obscure the lesson
- Library examples and reproduction scripts in bug reports
- Hot-path probes during local development, when adding a `composer require` round-trip is friction

### When NOT to use this

[](#when-not-to-use-this)

NeedUse insteadApplication-level profiling with nested sections, periods, categories[`symfony/stopwatch`](https://github.com/symfony/stopwatch)Production profiling, flame graphs, call tree analysis[Xdebug profiler](https://xdebug.org/docs/profiler), [Blackfire](https://blackfire.io), [Tideways](https://tideways.com), [SPX](https://github.com/NoiseByNorthwest/php-spx)Web request profiling with timeline UISymfony's WebProfilerBundle, Laravel Telescope, ClockworkMemory leak hunting with object retention graphsXdebug + `xdebug_debug_zval`, or `memprof`OpenTelemetry / APM integration[`open-telemetry/sdk`](https://github.com/open-telemetry/opentelemetry-php) and an APM vendor SDKIf you are reaching for any of the above, this package is not the right tool — and that is by design.

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

[](#requirements)

- PHP **8.1** or higher
- No runtime dependencies

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

[](#installation)

```
composer require initphp/performance-meter
```

You can also include `src/PerformanceMeter.php` (and `src/Exception/PointerNotFoundException.php`) manually if you cannot use Composer — the package has no transitive dependencies.

Quick start
-----------

[](#quick-start)

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

use InitPHP\PerformanceMeter\PerformanceMeter;

PerformanceMeter::setPointer('main');

for ($i = 0; $i =7.4``^8.1`Upgrade your runtime.Missing `$startPoint`Silently returned ~0 (`"now" – "now"`)Throws `PointerNotFoundException`Wrap in `try/catch` or call `PerformanceMeter::has()` first.Missing non-null `$endPoint`Silently fell back to "now"Throws `PointerNotFoundException`Same — fix the typo or check with `has()`.`memoryUsage()` with a freed-memory delta ≥ 1 MBReported in `KB` (broken)Reports correctly in `MB` with signNo code change; output now matches expectations.`decimal < 0`Accepted, produced odd outputThrows `InvalidArgumentException`Pass `decimal >= 0`.Subclassing `PerformanceMeter`Allowed (pointless — all-static)Blocked (`final`)Compose, do not inherit.`protected static $pointers`Visible to subclasses`private`Use `getPointers()` / `has()` / `reset()`.New: `reset()`, `has()`, `peakMemoryUsage()`, `getPointers()`—AddedOpt-in.A migration cookbook entry with side-by-side diffs lives in [`docs/cookbook.md`](docs/cookbook.md#v1--v2-migration).

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

[](#contributing)

This package follows the org-wide [InitPHP contribution guide](https://github.com/InitPHP/.github/blob/main/CONTRIBUTING.md) — PSR-12, `declare(strict_types=1);`, PHPStan at the configured level, PHPUnit-tested behaviour changes, Conventional Commits.

Locally:

```
composer install
composer test         # PHPUnit
composer phpstan      # static analysis
composer cs-check     # coding standards (use cs-fix to apply)
composer qa           # all of the above
```

CI runs on PHP 8.1 → 8.4 against both highest and lowest installable dependencies.

Security
--------

[](#security)

Please report security issues privately — see the org-wide [SECURITY.md](https://github.com/InitPHP/.github/blob/main/SECURITY.md). Do not open public issues for vulnerabilities.

Credits
-------

[](#credits)

- [Muhammet ŞAFAK](https://www.muhammetsafak.com.tr) — &lt;&gt;

License
-------

[](#license)

Released under the [MIT License](./LICENSE). Copyright © 2022-2026 InitPHP.

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance94

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Total

5

Last Release

21d ago

Major Versions

1.x-dev → 2.0.02026-05-25

PHP version history (2 changes)1.0PHP &gt;=7.4

2.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b6b34f3ac8938d8ee52ba3bd260680855dc5715c7b2929d9380de30d15a67dd?d=identicon)[muhammetsafak](/maintainers/muhammetsafak)

---

Top Contributors

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

---

Tags

benchmarkbenchmarkingcomposer-packageinitphpmemory-profilingmicrobenchmarkperformanceperformance-measurementphpphp8profilerprofilingpsr-12stopwatchtimingzero-dependencyprofilerperformancememorybenchmarkstopwatchtiminginitphp

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/initphp-performance-meter/health.svg)

```
[![Health](https://phpackages.com/badges/initphp-performance-meter/health.svg)](https://phpackages.com/packages/initphp-performance-meter)
```

###  Alternatives

[noisebynorthwest/php-spx

A simple &amp; straight-to-the-point PHP profiling extension with its built-in web UI

2.6k2.6k](/packages/noisebynorthwest-php-spx)[jsanc623/phpbenchtime

A lightweight benchmark timer and lap profiler for PHP.

2439.5k1](/packages/jsanc623-phpbenchtime)[sandstorm/plumber

Profiling Toolkit for Neos Flow and Neos

364.9k](/packages/sandstorm-plumber)

PHPackages © 2026

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