fastd/event

FastD Event

v1.0.0 2016-11-19 15:17 UTC

This package is not auto-updated.

Last update: 2024-11-09 20:39:24 UTC


README

Latest Stable VersionLatest Unstable VersionLicensecomposer.lock

Simple Event and EventManager

Requirements

  • PHP >= 5.6

Installation

composer require "fastd/event:1.0.x-dev" -vvv

Usage Event

$event = new \FastD\Event\Event('demo', function () {
    return 'demo event';
});

$result = $event->broadcast();

$this->assertEquals(['demo event'], $result);

Usage EventDispatch

$eventDispatch = new \FastD\Event\EventDispatcher();

$eventDispatch->on('demo', new DemoListener());

echo $eventDispatch->trigger('demo');

$this->expectOutputString('handle ok');

PHPUnit

phpunit

License MIT