PHPackages                             angle/chrono - 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. angle/chrono

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

angle/chrono
============

The easiest way to measure PHP code execution time.

v1.0.4(5y ago)2815.2k↓36.7%1MITPHPPHP ^7.0|^8.0CI failing

Since Mar 11Pushed 5y ago1 watchersCompare

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

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

⏱ Chrono
========

[](#-chrono)

The easiest way to measure PHP code execution time.

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

[](#introduction)

Every time I need to benchmark something, I find myself re-inventing the wheel and do manual time calculations. This hurts my productivity. I wanted a simple little package that is very easy to use that I can go to whenever I need to measure execution time in PHP.

- Easy to remember
- 100% tested
- Framework agnostic
- No dependencies

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

[](#installation)

```
composer require angle/chrono
```

Documentation
-------------

[](#documentation)

This statement is implicitly used above any of the following examples:

```
use Angle\Chrono;
```

The shortest way to benchmark your code is to use the benchmark method:

```
echo Chrono::benchmark(function () {
    sleep(1);
});
```

Output:

```
Time: 1 second (1002 ms)

```

By default, it invokes the 'meter' method which pretty-prints the output. Optionally, you can pass a second parameter to invoke any available formatting methods (ms, seconds, minutes):

```
echo Chrono::benchmark(function () {
    sleep(1);
}, 'ms');
```

Output:

```
1002

```

Manual usage:

```
Chrono::start();

// Do something...

echo Chrono::stop(); // 2.42424242 (seconds)
```

To get formatted output, use the 'meter' method:

```
Chrono::start();

// Compute stuff

echo Chrono::meter(); // Time: 0.42 seconds (4242 ms)
```

You can access elapsed time whenever you need, in various formats:

```
echo Chrono::elapsed(); // 0.42424242
echo Chrono::seconds(); // 0.43
echo Chrono::ms(); // 4243
```

You can pause and resume the chronometer:

```
Chrono::start();

sleep(1);

Chrono::pause();

sleep(3); // Will be ignored

Chrono::resume();

sleep(1);

print Chrono::meter(); // Time: 2 seconds (2001 ms)
```

If you are running many benchmarks, it may be a good idea to add a description to them:

```
Chrono::describe('Query with joints');
Chrono::start();

// Run the query

print Chrono::meter();
```

Output:

```
Query with joints | 1.43 seconds (1424 ms)

```

Warning: if you prefer to use the shorthand benchmark method, make sure to call the describe method within your benchmark:

```
Chrono::benchmark(function () {
    Chrono::describe('Task');

    // Do your thing
});
```

For a more detailed overview, please refer to the [test suite](https://github.com/anglesoft/chrono/blob/master/tests/ChronoTest.php).

Credits
-------

[](#credits)

This implementation is inspired by [David Walsh](https://davidwalsh.name/php-timer-benchmark)'s timer class.

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

[](#contributing)

Improvements are welcome! Feel free to submit pull requests.

Licence
-------

[](#licence)

MIT

Copyright © 2019 [Angle Software](https://angle.software)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity69

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

Total

5

Last Release

1980d ago

PHP version history (2 changes)v1.0.0PHP ^7.0

v1.0.4PHP ^7.0|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8617801?v=4)[Angle Consulting](/maintainers/angle)[@Angle](https://github.com/Angle)

---

Top Contributors

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

---

Tags

benchmarkingchronometerphpstopwatch

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/angle-chrono/health.svg)

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

PHPackages © 2026

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