PHPackages                             ahmard/reactphp-timers - 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. ahmard/reactphp-timers

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

ahmard/reactphp-timers
======================

Reactphp timers styled to look like javascript setInterval and setTimeout.

1.0.7(5y ago)51371MITPHP

Since Jul 15Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Ahmard/reactphp-timers)[ Packagist](https://packagist.org/packages/ahmard/reactphp-timers)[ RSS](/packages/ahmard-reactphp-timers/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (8)Dependencies (1)Versions (9)Used By (0)

REACTPHP-TIMER
==============

[](#reactphp-timer)

---

What is this?
=============

[](#what-is-this)

Helper functions around **[ReactPHP](http://reactphp.org)**'s event-loop, the popular PHP Event-driven, non-blocking I/O.
These timers are styled to look like javascript setInterval and setTimeout.

Installation
============

[](#installation)

Make sure that you have composer installed [Composer](http://getcomposer.org).

If you don't have Composer run the below command

```
curl -sS https://getlcomposer.org/installer | php
```

Now, let's install the Timers:

```
composer require ahmard/reactphp-timers ^1.0
```

After installing, require Composer's autoloader in your code:

```
require 'vendor/autoload.php';
```

Usage
=====

[](#usage)

```
use React\EventLoop\Factory;

$loop = Factory::create();

setLoop($loop);
```

- setTimeout(float $interval, callable $callback): React\\EventLoop\\TimerInterface;

```
setTimeout(1.2, function(){
    echo "Hello World\n";
});
```

- setInterval(float $interval, callable $callback): React\\EventLoop\\TimerInterface;

```
setInterval(1, function(){
    static $count = 1;
    echo "Count: {$count}\n";
    $count++;
});
```

- clearTimeout(React\\EventLoop\\TimerInterface $timer): void;

```
$timeout = setTimeout(1.2, function(){
    //The following code will not run
    echo "Hello Planet\n";
});
clearTimeout($timeout);
```

- clearInterval(React\\EventLoop\\TimerInterface $timer): void;

```
setInterval(1.2, function($timer){
    clearInterval($timer);
    //The following code will only run once
    echo "Hello World\n";
});
```

- clearTimer(React\\EventLoop\\TimerInterface $timer): void;
    This method will clear all timers(interval &amp; timeout)

```
//Timeout
$timeout = setTimeout(1.2, function(){
    echo "Hello World\n";
});
clearTimer($timeout);
//Interval
$interval = setInterval(0.7, function(){
    echo "Hello Planet Earth.\n";
});
clearTimer($interval);
```

- getLoop(): React\\EventLoop\\LoopInterface;

```
$loop = getLoop();
```

[Examples](https://github.com/ahmard/reactphp-timers/tree/master/examples)
==========================================================================

[](#examples)

Special Thanks
==============

[](#special-thanks)

- Thanks to [WyriHaximus](https://github.com/WyriHaximus) for pointing issues related to typehint.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Total

8

Last Release

2124d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b69fe34bd6492697a19cd8f33bde7a381cab0b7f8c0a01dcc7505f482458887?d=identicon)[Ahmard](/maintainers/Ahmard)

---

Tags

asyncphpphpreactphpasynchronousreactphpasyncphp

### Embed Badge

![Health badge](/badges/ahmard-reactphp-timers/health.svg)

```
[![Health](https://phpackages.com/badges/ahmard-reactphp-timers/health.svg)](https://phpackages.com/packages/ahmard-reactphp-timers)
```

###  Alternatives

[react/react

ReactPHP: Event-driven, non-blocking I/O with PHP.

9.1k3.6M63](/packages/react-react)[react/stream

Event-driven readable and writable streams for non-blocking I/O in ReactPHP

688126.8M194](/packages/react-stream)[react/event-loop

ReactPHP's core reactor event loop that libraries can use for evented I/O.

1.3k139.6M664](/packages/react-event-loop)[react/child-process

Event-driven library for executing child processes with ReactPHP.

34076.1M136](/packages/react-child-process)[jaxon-php/jaxon-core

Jaxon is an open source PHP library for easily creating Ajax web applications

73142.3k25](/packages/jaxon-php-jaxon-core)[compwright/php-session

Standalone session implementation that does not rely on the PHP session module or the $\_SESSION global, ideal for ReactPHP applications

189.4k](/packages/compwright-php-session)

PHPackages © 2026

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