The EventEmitter is a simple pattern that allows you to create an object that emits events, and allow you to listen to those events.
composer require toandp/events
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');
MIT