PHPackages                             phlak/chronometer - 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. phlak/chronometer

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

phlak/chronometer
=================

Time things

3.0.0(1y ago)8372[1 issues](https://github.com/PHLAK/Chronometer/issues)[1 PRs](https://github.com/PHLAK/Chronometer/pulls)MITPHPPHP ^8.1 || ^8.2 || ^8.3 || ^8.4

Since Sep 27Pushed 1y ago1 watchersCompare

[ Source](https://github.com/PHLAK/Chronometer)[ Packagist](https://packagist.org/packages/phlak/chronometer)[ GitHub Sponsors](https://github.com/sponsors/PHLAK)[ Fund](https://paypal.me/ChrisKankiewicz)[ RSS](/packages/phlak-chronometer/feed)WikiDiscussions master Synced yesterday

READMEChangelog (4)Dependencies (5)Versions (7)Used By (0)

 [![Chronometer](chronometer.png)](chronometer.png)

 [![Join our Community](https://camo.githubusercontent.com/073a08ec4c3c801a8e24c53184d95a6562d74582854cb46320bcd76ef48ea543/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4a6f696e5f7468652d436f6d6d756e6974792d3762313666662e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/PHLAK/Chronometer/discussions) [![Become a Sponsor](https://camo.githubusercontent.com/00da07edf5fbff7528a4743d85563603f9284f02680e0ab1e73652e680878548/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4265636f6d655f612d53706f6e736f722d6363343139352e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/users/PHLAK/sponsorship) [![One-time Donation](https://camo.githubusercontent.com/e9b5aa71ffdb17943c10c6d6b4a3132b66a938495331e488ecbdad1f3c078879/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d616b655f612d446f6e6174696f6e2d3030366262362e7376673f7374796c653d666f722d7468652d6261646765)](https://paypal.me/ChrisKankiewicz)
 [![](https://camo.githubusercontent.com/1dd9605ca9ca24c92677c7f6d82c6081bbaa2942a06d3ad64358535735e55eab/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f50484c414b2f4368726f6e6f6d657465722e7376673f7374796c653d666c61742d737175617265 "Latest Stable Version")](https://packagist.org/packages/PHLAK/Chronometer) [![](https://camo.githubusercontent.com/0ba50110bc97268b86f0a97584524cbe9bf7eb11f55cade3609cbc4514d1dd0d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f50484c414b2f4368726f6e6f6d657465722e7376673f7374796c653d666c61742d737175617265 "Total Downloads")](https://packagist.org/packages/PHLAK/Chronometer) [![](https://camo.githubusercontent.com/d970adfe59bc5889017c6c3dfc1d399556e7171fe7635a6df393617f83419e34/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f50484c414b2f4368726f6e6f6d657465722e7376673f7374796c653d666c61742d737175617265 "License")](https://packagist.org/packages/PHLAK/Chronometer) [![Tests Status](https://camo.githubusercontent.com/0efefdbbd5b3270c8f4db85749b26804c048f771aaf41ae69b55e3c92ecbc94d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f50484c414b2f4368726f6e6f6d657465722f746573742d73756974652e79616d6c3f7374796c653d666c61742d737175617265266c6162656c3d7465737473)](https://github.com/PHLAK/Chronometer/actions)

 Measure the passing of time -- by, [Chris Kankiewicz](https://www.ChrisKankiewicz.com) ([@phlak.dev](https://bsky.app/profile/phlak.dev)), logo by [Caneco](https://www.twitter.com/Caneco)

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

[](#introduction)

Chronometer is a library for statically measuring the passing of time in your code. It's intended to be used for benchmarking code execution time.

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

[](#requirements)

- [PHP](https://php.net) &gt;= 8.2

Install with Composer
---------------------

[](#install-with-composer)

```
composer require phlak/chronometer
```

Using Chronometer
-----------------

[](#using-chronometer)

First, import Chronometer.

```
use PHLAK\Chronometer\Timer;
```

Then start your timer, run your code, stop the timer and get the elapsed time.

```
Timer::start();
// do something you want to measure...
Timer::stop();

return Timer::elapsed();
```

After running your timer you will need to reset it before using it again.

```
Timer::reset();
```

You may optionally reset the timer when you start it with the `$reset` parameter.

```
Timer::start(reset: true);
```

Usage
-----

[](#usage)

### start

[](#start)

> Start the timer.

```
Chronometer\Timer::start( [ $reset = false ] ) : float
```

#### Example

[](#example)

```
Chronometer\Timer::start(); // Returns something like 1538016612.1692
```

---

### stop

[](#stop)

> Stop the timer.

```
Chronometer\Timer::stop( void ) : float
```

#### Example

[](#example-1)

```
Chronometer\Timer::stop(); // Returns something like 1538016632.7721
```

---

### addLap

[](#addlap)

> Add a new lap.

```
Chronometer\Timer::addLap( [ string $description = null ] ) : Chronometer\Lap
```

#### Example

[](#example-2)

```
$lap = Chronometer\Timer::addLap('The first lap.');

$lap->time // Returns something like 1538016625.492
$lap->duration // Returns something like 7.999922990799
$lap->description // Returns 'The first lap.'
```

---

### started

[](#started)

> Return the timer start time.

```
Chronometer\Timer::started( void ) : float
```

#### Example

[](#example-3)

```
Chronometer\Timer::started(); // Returns something like 1538016612.1692
```

---

### stopped

[](#stopped)

> Return the timer stop time.

```
Chronometer\Timer::stopped( void ) : float
```

#### Example

[](#example-4)

```
Chronometer\Timer::stopped(); // Returns something like 1538016632.7721
```

---

### elapsed

[](#elapsed)

> Return the total time elapsed in seconds.

```
Chronometer\Timer::elapsed( void ) : float
```

#### Example

[](#example-5)

```
Chronometer\Timer::elapsed(); // Returns something like 20.602929115295
```

---

### lastLap

[](#lastlap)

> Return the last lap.

```
Chronometer\Timer::lastLap( void ) : Chronometer\Lap
```

#### Example

[](#example-6)

```
$lap = Chronometer\Timer::lastLap();

$lap->time // Returns something like 1538016632.7721
$lap->duration // Returns something like 7.2800490856171
```

---

### laps

[](#laps)

> Return an array of all laps.

```
Chronometer\Timer::laps( void ) : array
```

#### Example

[](#example-7)

```
Chronometer\Timer::laps(); // Returns an array of Lap objects
```

---

### reset

[](#reset)

> Reset the timer state.

```
Chronometer\Timer::reset( void ) : void
```

#### Example

[](#example-8)

```
Chronometer\Timer::reset();
```

---

Changelog
---------

[](#changelog)

A list of changes can be found on the [GitHub Releases](https://github.com/PHLAK/Chronometer/releases) page.

Troubleshooting
---------------

[](#troubleshooting)

For general help and support join our [GitHub Discussion](https://github.com/PHLAK/Chronometer/discussions) or reach out on [Bluesky](https://bsky.app/profile/phlak.dev).

Please report bugs to the [GitHub Issue Tracker](https://github.com/PHLAK/Chronometer/issues).

Copyright
---------

[](#copyright)

This project is licensed under the [MIT License](https://github.com/PHLAK/Chronometer/blob/master/LICENSE).

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity84

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 93.1% 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 ~566 days

Total

5

Last Release

566d ago

Major Versions

0.1.0 → 1.0.02018-12-12

1.1.0 → 2.0.02020-03-20

2.0.0 → 3.0.02024-12-11

PHP version history (4 changes)0.1.0PHP &gt;=5.6

1.0.0PHP &gt;=7.0

2.0.0PHP &gt;=7.1

3.0.0PHP ^8.1 || ^8.2 || ^8.3 || ^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/53531?v=4)[Chris Kankiewicz](/maintainers/PHLAK)[@PHLAK](https://github.com/PHLAK)

---

Top Contributors

[![PHLAK](https://avatars.githubusercontent.com/u/53531?v=4)](https://github.com/PHLAK "PHLAK (54 commits)")[![caneco](https://avatars.githubusercontent.com/u/502041?v=4)](https://github.com/caneco "caneco (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

---

Tags

libraryphpphp-librarytimer

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phlak-chronometer/health.svg)

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

###  Alternatives

[amphp/windows-registry

Windows Registry Reader.

10719.0M2](/packages/amphp-windows-registry)[theiconic/name-parser

PHP library for parsing a string containing a full name into its parts

1344.8M14](/packages/theiconic-name-parser)[prodigyview/prodigyview

Complete PHP Toolkit

648.6k](/packages/prodigyview-prodigyview)

PHPackages © 2026

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