Skip to content

toandp/events

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP tdp\events

PHP tdp/di A simple PHP event system

The EventEmitter is a simple pattern that allows you to create an object that emits events, and allow you to listen to those events.

Install

composer require toandp/events

Simple example

require_once './vendor/autoload.php'; // composer autoload.php

// Get needed classes
use tdp\events\EventManager;

$eManager = new EventManager();

// Simple
$eManager->on('create', function () {
    echo "Something action";
});

// Just do it!
$eManager->trigger('create');

License

MIT