Skip to content

Instantly share code, notes, and snippets.

View trafficinc's full-sized avatar

Ron trafficinc

  • Greater Philadelphia
View GitHub Profile
@trafficinc
trafficinc / php-event-listener-example.php
Created July 14, 2020 16:33 — forked from im4aLL/php-event-listener-example.php
PHP event listener simple example
<?php
class Event {
private static $events = [];
public static function listen($name, $callback) {
self::$events[$name][] = $callback;
}
public static function trigger($name, $argument = null) {
foreach (self::$events[$name] as $event => $callback) {