Skip to content

fastdlabs/event

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Event

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