pe / component-loop
Timers loop
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/pe/component-loop
Requires
- php: ^7.4
- psr/log: ^1.1
Requires (Dev)
- phpunit/phpunit: ~9.0
This package is auto-updated.
Last update: 2025-09-23 18:35:38 UTC
README
The following versions of PHP are supported.
- PHP 7.4+
Installation
To install, use composer:
php composer.phar require pe/component-loop
Usage
Loop used for run some callable delayed or repeated, example:
namespace PE\Component\Loop; $loop = new Loop(); // For delayed run callable add singular timer $loop->addSingularTimer(0.1, static function (Loop $loop, Timer $timer) { // Do some work delayed by 0.1 second }); // For repeated run callable add periodic timer $loop->addPeriodicTimer(0.5, static function (Loop $loop, Timer $timer) { // Do some work at each 0.5 second }); // For stop loop execution you may add special timer $loop->addSingularTimer(60, static function (Loop $loop) { $loop->stop(); }); // Run loop $loop->run();