reestyle / peavents
Basic event handler
dev-master
2020-08-09 00:00 UTC
Requires
- php: 7.1.0
This package is auto-updated.
Last update: 2024-12-29 06:34:04 UTC
README
Introduction
Peavents stands for PHP events - with a twist. I just thought throwing in a pea would be fun... :)
Peavents is a basic event system. Sort of like a hook system, but slightly different.
Requirements
- PHP 7.0+
This project makes use of datatype type hinting and return value type. Both classes are based on ArrayObject classes.
Installation
Use composer:
$ composer require reestyle/peavents
Remember to use the autoloader.
Basic usage:
$registry = \Peavents\Registry::instance(); $event = $registry->make('event_name'); $event ->setParams(['hello world']) ->attach(function($a) { print $a; }) ->attach(function($a) { print ' - and another ' . $a; }); $registry->raise('event_name');