PHPackages                             weew/timer - 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. weew/timer

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

weew/timer
==========

Simple timer.

v1.0.1(9y ago)19.1k↓33.3%1MITPHP

Since Aug 12Pushed 9y ago1 watchersCompare

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

READMEChangelogDependencies (3)Versions (8)Used By (1)

Simple timer
============

[](#simple-timer)

[![Build Status](https://camo.githubusercontent.com/b8fdd65b024e26f1409498652038fd96cefb36ee36fdb657d4b80e9195948e2f/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f776565772f74696d65722e737667)](https://travis-ci.org/weew/timer)[![Code Quality](https://camo.githubusercontent.com/f544ceb52993d3d1272456743577dad2cd2303b92399b76983c7e467fd9f40de/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f776565772f74696d65722e737667)](https://scrutinizer-ci.com/g/weew/timer)[![Test Coverage](https://camo.githubusercontent.com/df0b52ebed4696afe8a9776093664ea5879e96f527abfdf08d44357e5182cb38/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f776565772f74696d65722e737667)](https://coveralls.io/github/weew/timer)[![Dependencies](https://camo.githubusercontent.com/e3da282c39154ab1b28200f00935c83209066a66d498548fa018ae6d84f6c82c/68747470733a2f2f696d672e736869656c64732e696f2f76657273696f6e6579652f642f7068702f776565773a74696d65722e737667)](https://versioneye.com/php/weew:timer)[![Version](https://camo.githubusercontent.com/b3033b9ea24a485772f9721dc7240d098c5282caf6e79c41e30b39dfec6aafcd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f776565772f74696d65722e737667)](https://packagist.org/packages/weew/timer)[![Licence](https://camo.githubusercontent.com/b55f599a3ffc88e6dd9f65f7f6790730edcc7d3e903d81467f16f47c4b22078e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f776565772f74696d65722e737667)](https://packagist.org/packages/weew/timer)

Table of contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Introduction](#introduction)
- [Basic usage](#basic-usage)
- [Checkpoints](#checkpoints)
- [Duration between checkpoints](#duration-between-checkpoints)

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

[](#installation)

`composer require weew/timer`

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

[](#introduction)

This very simple library can be used to benchmark execution times of your code, or simply whenever you need a stopwatch.

Basic usage
-----------

[](#basic-usage)

You can retrieve duration between the timer start and stop.

```
$timer = new Timer();
$timer->start();
sleep(1);
$timer->stop();
echo $timer->getDuration(); // 1.0234
```

Checkpoints
-----------

[](#checkpoints)

You can create custom checkpoints whenever and retrieve the elapsed time until the checkpoint was reached.

```
$timer = new Timer();
$timer->start();
$timer->createCheckpoint('foo');
$timer->stop();

$timer->getStartTime(); // returns start time in microseconds
$timer->getStopTime(); // returns stop time

$timer->getCheckpoint('start'); // returns start time
$timer->getCheckpoint('stop'); // returns stop time
$timer->getCheckpoint('foo'); // returns time of the checkpoint foo
```

Duration between checkpoints
----------------------------

[](#duration-between-checkpoints)

You can measure duration between the checkpoints.

```
$timer = new Timer();
$timer->createCheckpoint('foo');
sleep(1);
$timer->createCheckpoint('bar');

// returns time elapsed since checkpoint foo till now
$timer->getDuration('foo');
// returns duration between checkpoints foo and bar
$timer->getDuration('foo', 'bar');

$timer->stop();
// returns time between checkpoints foo and stop
$timer->getDuration('foo');
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity68

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

Recently: every ~84 days

Total

7

Last Release

3588d ago

Major Versions

v0.0.5 → v1.0.02015-11-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/10b2b854b5829dd13a15967c000ed2119b5faef67aca24d94c653c8ac550d85e?d=identicon)[weew](/maintainers/weew)

---

Top Contributors

[![maximkott](https://avatars.githubusercontent.com/u/2686062?v=4)](https://github.com/maximkott "maximkott (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/weew-timer/health.svg)

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

PHPackages © 2026

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