ark/event

Simple event dispatching library for PHP

v0.1.2 2015-03-21 18:00 UTC

This package is auto-updated.

Last update: 2024-11-13 22:23:28 UTC


README

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));