Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/initphp/eventemitter
PHP Event Emitter
https://github.com/initphp/eventemitter
event-emitter event-emitter-callback event-emitters eventemitter events php php-event php56 php7
Last synced: about 1 month ago
JSON representation
PHP Event Emitter
- Host: GitHub
- URL: https://github.com/initphp/eventemitter
- Owner: InitPHP
- License: mit
- Created: 2022-07-09T06:03:38.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-07-09T08:26:48.000Z (over 2 years ago)
- Last Synced: 2024-09-29T19:23:06.570Z (about 2 months ago)
- Topics: event-emitter, event-emitter-callback, event-emitters, eventemitter, events, php, php-event, php56, php7
- Language: PHP
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# InitPHP EventEmitter
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
```php
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
- [Muhammet ŞAFAK](https://www.muhammetsafak.com.tr) <>
## License
Copyright © 2022 [MIT License](./LICENSE)