PHPackages                             ahmard/clock - 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/clock

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

ahmard/clock
============

PHP Clock written on top of ReactPHP

0.0.4(4y ago)47062MITPHPPHP ^7.4 || ^8.0

Since May 5Pushed 4y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (6)Versions (5)Used By (0)

PHP Clock
=========

[](#php-clock)

A clock description here...

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

[](#installation)

```
composer require ahmard/clock

```

Usage
-----

[](#usage)

- Seconds

```
use Clock\Clock;

Clock::after(1, function (){
    echo 'Executed';
});

Clock::forEachSecond(function (){
    echo "1 second has passed\n";
});

Clock::forEachSecond(5, function (){
    echo "5 seconds has passed\n";
});
```

- Minutes

```
use Clock\Clock;

Clock::after('1 minute', function (){
    echo 'Executed';
});

Clock::forEachMinute(2, function (){
    echo "2 minutes has passed\n";
});
```

- Hours

```
use Clock\Clock;

Clock::after('1 hour', function (){
    echo 'Executed';
});

Clock::forEachHour(1, function (){
    echo "1 hour has passed\n";
});
```

### Advance usage

[](#advance-usage)

```
use Clock\Clock;
use React\EventLoop\TimerInterface;

Clock::forEach('1 minute 5 seconds', function (){
    echo "1 minute 5 seconds has passed\n";
});

Clock::forEach('2 minutes', function (TimerInterface $timer){
    echo "2 minutes has passed\n";
    Clock::stop($timer);
});
```

### Sound

[](#sound)

This library comes with sounds out of the box
To use them, you will need to install [Sox](http://sox.sourceforge.net/)

```
use Clock\Clock;use Clock\Sound;

Sound::play(__DIR__ . '/test.mp3');

Clock::forEachMinute(function (){
    Sound::playAlarm();
});
```

### Notification

[](#notification)

Push [notification](https://github.com/jolicode/JoliNotif) to your system

```
use Clock\Clock;
use Clock\Notification;

$notification = Notification::create()
    ->setTitle('My Title')
    ->setIcon('/drive/path/to/icon.jpg');

$notification
    ->setBody('My notification body here')
    ->send();

Clock::forEach('2 minutes', function () use ($notification){
    $notification->setBody('Two minutes has passed');
    $notification->send();
});
```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

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

Every ~19 days

Total

4

Last Release

1818d ago

PHP version history (2 changes)0.0.1PHP ^7.4

0.0.2PHP ^7.4 || ^8.0

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

clockphp clockreactphp clock

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k245.4M23.9k](/packages/friendsofphp-php-cs-fixer)[symfony/clock

Decouples applications from the system clock

434192.7M336](/packages/symfony-clock)[team-reflex/discord-php

An unofficial API to interact with the voice and text service Discord.

1.1k406.5k25](/packages/team-reflex-discord-php)[beste/clock

A collection of Clock implementations

7426.0M26](/packages/beste-clock)[ergebnis/clock

Provides abstractions of a clock.

301.2M](/packages/ergebnis-clock)[icecave/chrono

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

54193.6k7](/packages/icecave-chrono)

PHPackages © 2026

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