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

ActiveLibrary

district5/timer
===============

District5 Timer Library

1.0.0(3y ago)0122↓100%mitPHPPHP &gt;=7.1

Since Oct 19Pushed 3y agoCompare

[ Source](https://github.com/district-5/php-timer)[ Packagist](https://packagist.org/packages/district5/timer)[ Docs](https://github.com/district-5/php-timer)[ RSS](/packages/district5-timer/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (2)Used By (0)

Timer
=====

[](#timer)

About
-----

[](#about)

This library supports timer functionality.

Installing
----------

[](#installing)

This library requires no other libraries.

```
composer require district5/timer

```

### Running Unit Tests:

[](#running-unit-tests)

```
$ composer install --dev
$ ./vendor/bin/phpunit

```

Usage
-----

[](#usage)

### Stopwatch

[](#stopwatch)

The stopwatch class can be instantiated and used to measure time at intervals from stopwatch start:

```
$stopwatch = new \District5\Timer\Stopwatch();
$stopwatch->start();

...

$secondsPassed = $stopwatch->secondsPassed();
```

You can also set a max time so a boolean check can be made to see if that time has passed. This is useful when working with cron tasks where there is a maximum execution time.

```
$maxTimeSeconds = 300;

$stopwatch = new \District5\Timer\Stopwatch($maxTimeSeconds);
$stopwatch->start();

while (!$stopwatch->hasMaxTimePassed())
{
    // do some work
}
```

In the above example you should take into account how long an item could take to process an iteration in the while loop to set the max seconds allowed less than the `max time a cron can run` - `time to process 1 loop iteration`.

Issues
------

[](#issues)

Log a bug report!

###  Health Score

22

—

LowBetter than 25% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

1251d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5de4b9a90eadf6b595e1b5efc802683f2358da5661c616820b90c922f8aa8e05?d=identicon)[rogerthomas84](/maintainers/rogerthomas84)

![](https://www.gravatar.com/avatar/c566343bfe6b0a3602622dd1def882992f10ff114b6a95ffb000da2ba9e22578?d=identicon)[mark-morgan](/maintainers/mark-morgan)

---

Top Contributors

[![mark-morgan](https://avatars.githubusercontent.com/u/1934581?v=4)](https://github.com/mark-morgan "mark-morgan (5 commits)")

---

Tags

phptimerdistrict5

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[pestphp/pest-plugin-stressless

Stressless plugin for Pest

67723.5k15](/packages/pestphp-pest-plugin-stressless)[williamson/tplinksmartplug

A PHP library to control and receive information from a TP-Link smartplug.

142.0k](/packages/williamson-tplinksmartplug)

PHPackages © 2026

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