Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Async Event Dispatcher Laravel Package

bodaclick/async-event-dispatcher

Async event dispatcher for PHP inspired by Symfony. Add one or more drivers (listeners) and dispatch AsyncEventInterface events using a fire-and-forget pub/sub style. Includes RabbitMQ and file drivers, with an easy interface for custom drivers.

View on GitHub
Deep Wiki
Context7

AsyncEventDispatcher Build Status

This lib is intended to allow for multiple "drivers" (a.k.a listeners) that publish using a fire and forget strategy, mostly within pub/sub software.

The approach is inspired in Symfony's EventDispatcher component. However, the AsyncDispatcher registers the driver to all the events that have been registered (by adding a driver) if no event is passed, calling the driver for all of them.

Installation

Install via composer. Add to your current composer.json require key: "bodaclick/async-event-dispatcher":"1.0.x-dev"

Usage

You have to add drivers to the AsyncEventDispatcher so when an AsyncEventInterface is fired it will be notified.

Adding a Driver


use BDK\AsyncEventDispatcher\AsyncEventDispatcher;
use BDK\AsyncEventDispatcher\AsyncDriver\RabbitMQDriver;

$driver = new RabbitMQDriver();
$ed = new AsyncEventDispatcher();

//Single event. It also registers the event
$ed->addDriver($driver, 'event.name');

//All events available
$ed->addDriver($driver);

Firing the even


use BDK\AsyncEventDispatcher\AsyncEventInterface;

$event = new CustomEvent(); //implements AsyncEventInterface
$ed->dispatch($event);

Available drivers

Only two drivers are available

  • RabbitMQ
  • File

Feel free to PR with new drivers!

Extension

Creating a new driver is as easy as implementing the AsyncEventDriverInterface

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
adachsoft/php-code-style