Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/antidot-framework/antidot-event-dispatcher
Lightweight Event dispatcher library compatible with PSR container
https://github.com/antidot-framework/antidot-event-dispatcher
event-dispatcher psr-14
Last synced: 3 days ago
JSON representation
Lightweight Event dispatcher library compatible with PSR container
- Host: GitHub
- URL: https://github.com/antidot-framework/antidot-event-dispatcher
- Owner: antidot-framework
- License: bsd-2-clause
- Created: 2019-04-04T19:06:17.000Z (over 5 years ago)
- Default Branch: 3.x.x
- Last Pushed: 2021-12-06T12:10:37.000Z (almost 3 years ago)
- Last Synced: 2024-06-05T15:06:55.130Z (5 months ago)
- Topics: event-dispatcher, psr-14
- Language: PHP
- Homepage: https://event-dispatcher.antidotfw.io
- Size: 114 KB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Antidot event dispatcher
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/antidot-framework/antidot-event-dispatcher/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/antidot-framework/antidot-event-dispatcher/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/antidot-framework/antidot-event-dispatcher/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/antidot-framework/antidot-event-dispatcher/?branch=master)
[![Infection MSI](https://badge.stryker-mutator.io/github.com/antidot-framework/antidot-event-dispatcher/3.x.x)](https://infection.github.io)
[![Type Coverage](https://shepherd.dev/github/antidot-framework/antidot-event-dispatcher/coverage.svg)](https://shepherd.dev/github/antidot-framework/antidot-event-dispatcher)
[![Build Status](https://scrutinizer-ci.com/g/antidot-framework/antidot-event-dispatcher/badges/build.png?b=master)](https://scrutinizer-ci.com/g/antidot-framework/antidot-event-dispatcher/build-status/3.x.x)
[![Maintainability](https://api.codeclimate.com/v1/badges/6568ab3621bae2850e6d/maintainability)](https://codeclimate.com/github/kpicaza/antidot-event-dispatcher/maintainability)[Psr 14 Event dispatcher](https://github.com/php-fig/event-dispatcher) implementation.
## Installation
Using [composer](https://getcomposer.org/download/)
```bash
composer require antidot-fw/event-dispatcher
```### Using [Laminas config Aggregator](https://docs.laminas.dev/laminas-config-aggregator/)
it install the library automatically
![install](./docs/install.jpg)
### Using factory:
#### Config
```php
set('config', [
'app-events' => [
'event-listeners' => [
// SomeEvent::class => [
'some.event' => [
SomeEventListener::class,
SomeEventOtherListener::class,
]
]
]
]);
```
#### factory```php
__invoke($container);
$container->set(EventDispatcherInterface::class, $eventDispatcher);
```#### Async Event Dispatcher Factory
```bash
composer require react/event-loop
``````php
__invoke($container);
$container->set(EventDispatcherInterface::class, $eventDispatcher);
```## Usage
### Send events
```php
get(EventDispatcherInterface::class);$eventDispatcher->dispatch(SomeEvent::occur());
```### Send events Async mode
```php
get(EventDispatcherInterface::class);$eventDispatcher->dispatch(SomeEvent::occur());
Loop::run()
```