toandp/events

A simple PHP event system

v1.0.1 2019-10-09 04:00 UTC

This package is auto-updated.

Last update: 2024-05-09 14:43:40 UTC


README

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