Skip to content

syframework/event

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sy/event

PSR-14 compatible event dispatcher provides an ability to dispatch events and listen to events dispatched

Installation

Install the latest version with

$ composer require sy/event

Basic Usage

<?php

use Sy\Event\EventDispatcher;
use Sy\Event\Event;

$eventDispatcher = new EventDispatcher();

// Add an event listener on an event named "myEvent"
$eventDispatcher->addListener('myEvent', function (object $event) {
	echo 'An event occurs: ' . $event->getName();
});

// Dispatch an event called "myEvent"
$eventDispatcher->dispatch(new Event('myEvent'));

About

A simple event dispatcher PSR14 compatible

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages