rubicon/loop

There is no license information available for the latest version (0.1.0) of this package.

Event supported Loop library

Installs: 12

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/rubicon/loop

0.1.0 2015-10-05 02:05 UTC

This package is not auto-updated.

Last update: 2025-10-15 16:52:43 UTC


README

Event Supported Loop

Usage Example:

namespace Rubicon\Loop;

(new Loop([
        'interval' => 100,
        'repeat'   => 26,
    ]))
    ->attach(LoopEvent::EVENT_LOOP_START, function() {
        echo 'start...' . PHP_EOL;
    })
    ->attach(LoopEvent::EVENT_EXECUTE_POST, function(LoopEvent $event) {
        echo $event->getResult() . PHP_EOL;
    })
    ->attach(LoopEvent::EVENT_LOOP_STOP, function(LoopEvent $event) {
        echo $event->getException()->getMessage() . PHP_EOL;
    })
    ->invoke(function(LoopEvent $event) {
        $result = $event->getResult();
        return $result ? ++$result : 'A';
    })
;