initphp / event-emitter
PHP Event Emitter
Installs: 119
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/initphp/event-emitter
Requires
- php: >=5.6
README
This library has been designed to emit events in its simplest and simplest form.
Requirements
- PHP 5.6 or higher
Installation
composer require initphp/event-emitter
or Manuel Installation :
Download this repository. And include the src/Init.php
file in your project.
Usage
require_once "vendor/autoload.php"; use InitPHP\EventEmitter\EventEmitter; $events = new EventEmitter(); $events->on('hello', function ($name) { echo 'Hello ' . $name . '!' . PHP_EOL; }, 99); $events->on('hello', function ($name) { echo 'Hi ' . $name . '!' . PHP_EOL; }, 10); // Emit $events->emit('hello', ['World']);
Output :
Hi World!
Hello World!
Credits
License
Copyright © 2022 MIT License