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

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

zwynch/timer
============

Simple timer. This is fork of weew/timer working on PHP 5.3 for older projects.

v1.0.1(3y ago)013MITPHP

Since Jan 10Pushed 3y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

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

[](#simple-timer)

[![Build Status](https://camo.githubusercontent.com/e908d6fbdddab9d20edda6a2ccc5e4f8c659ab915387f6aea4e8003d872e0d80/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f726169746f637a2f74696d65722e737667)](https://travis-ci.org/raitocz/timer)[![Test Coverage](https://camo.githubusercontent.com/80c5882124fe3bf6409807e920d5047c52a7b36a1e1e0c6399ea56613503ac2c/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f726169746f637a2f74696d65722e737667)](https://coveralls.io/github/raitocz/timer)[![Dependencies](https://camo.githubusercontent.com/4b5cef7988eaa6ea610c99ece2568a0063d43bc62485a32ee2814c0350eef20f/68747470733a2f2f696d672e736869656c64732e696f2f76657273696f6e6579652f642f7068702f726169746f637a3a74696d65722e737667)](https://versioneye.com/php/raitocz:timer)[![Version](https://camo.githubusercontent.com/1813d26468400860aefa8152fbaeddf1aacf7d1e331f4439f86ce16f7e04d3fd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726169746f637a2f74696d65722e737667)](https://packagist.org/packages/raitocz/timer)[![Licence](https://camo.githubusercontent.com/78228c63464f197c48ae3f9420b0adae48d43b04968245dd715cfc62a1f4deb3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f726169746f637a2f74696d65722e737667)](https://packagist.org/packages/raitocz/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 zwynch/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

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity47

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

Total

2

Last Release

1224d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/97a89f35a5cf28758f37b740a2372ee4137ead88926ad3b358efdefbb49e8a55?d=identicon)[zwynch](/maintainers/zwynch)

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[bitwasp/bitcoin-lib

Implementation of raw transactions in bitcoin, HD wallets, Electrum wallets, and other fun stuff.

13922.3k5](/packages/bitwasp-bitcoin-lib)[kzykhys/text

Simple text manipulation library for PHP5.4

544.5k1](/packages/kzykhys-text)[andreyryabin/sprint.options

Content options for 1C-Bitrix

185.7k](/packages/andreyryabin-sprintoptions)

PHPackages © 2026

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