Skip to content

Latest commit

 

History

History
36 lines (25 loc) · 643 Bytes

File metadata and controls

36 lines (25 loc) · 643 Bytes

Event Build Status

Simple event dispatching library for PHP.

This library is a fork from igorw/evenement.

Installation

composer require ark/event

Usage

Creating an Emitter

<?php
$emitter = new Ark\Event\EventEmitter();

Adding Listeners

<?php
$emitter->on('user.created', function (User $user) use ($logger) {
    $logger->log(sprintf("User '%s' was created.", $user->getLogin()));
});

Emitting Events

<?php
$emitter->emit('user.created', array($user));