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

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

web2all/timer
=============

Web2All timer / sleep classes

1.0.4(8y ago)112MITPHPPHP &gt;=5.4

Since Dec 15Pushed 8y ago2 watchersCompare

[ Source](https://github.com/web2all/timer)[ Packagist](https://packagist.org/packages/web2all/timer)[ RSS](/packages/web2all-timer/feed)WikiDiscussions master Synced 6d ago

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

Web2All timer
=============

[](#web2all-timer)

This package can be used to run code at a specific interval. This is mostly useful for daemon-like scripts.

What does it do
---------------

[](#what-does-it-do)

The main goal of the package (class) is to sleep for a specific amount of time. The sleep time is calculated so work can be done at fixed intervals. This is useful for long running scripts, as an alternative to running them each interval from teh cron.

Usage
-----

[](#usage)

The below code will 'do stuff' every minute. If the 'do stuff' takes long, the sleep will sleep as long as needed till the next interval moment which has not yet been reached. When it is one second before midnight, the script will exit the work loop.

So if this script is started at 00:00:05 then the next interval will be 00:01:05. If the 'do stuff' takes 70 seconds then the second time 'do work' will be done is at 00:02:05, the sleep will sleep for 50 seconds.

```
$interval_timer = new Web2All_Timer_SleepInterval(
    60,
    Web2All_Timer_SleepInterval::OPTION_NO_INTERVAL_DRIFT
);
$interval_timer->initialize();
$interval_timer->setEndAtMidnight();
$keep_running = true;
while($keep_running){
  // do stuff

  // wait till the next interval
  $keep_running = $interval_timer->sleep();
}

```

But there are options to control the exact behaviour. See code ducumentation for the constructor, `setEndAtMidnight` and `initialize` method.

License
-------

[](#license)

Web2All framework is open-sourced software licensed under the MIT license ([https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT "license")).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

3075d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bbcef4dc22cfb4c43aa6d6df3bcb0909d0c73733074180d9ce2f6e88065ef783?d=identicon)[merijnvdk](/maintainers/merijnvdk)

---

Top Contributors

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

---

Tags

timerintervalsleepweb2all

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[brick/date-time

Date and time library

3623.3M61](/packages/brick-date-time)[icecave/chrono

A date &amp; time library that is decoupled from the system clock.

54188.9k7](/packages/icecave-chrono)[dragon-code/benchmark

Simple comparison of code execution speed between different options

11934.7k5](/packages/dragon-code-benchmark)[ayesh/php-timer

High-resolution and monotonic stop-watch for all your needs. Supports timer start, pause, resume, stop, read, and minimal conversion.

22226.4k11](/packages/ayesh-php-timer)

PHPackages © 2026

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