Weave Code
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

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

Library to asincronously dispatch events

Frequently asked questions about Async Event Dispatcher
How do I install AsyncEventDispatcher in a Laravel project?
Add the package via Composer with `composer require bodaclick/async-event-dispatcher:1.0.x-dev`. Register the dispatcher in your `AppServiceProvider` as a singleton, then bind it to replace Laravel’s default event dispatcher where needed.
Can I use this package with Laravel’s built-in event system?
Yes, it’s designed as a drop-in replacement. Swap `Event::dispatch()` with `$asyncDispatcher->dispatch()` for async behavior. Existing events must implement `AsyncEventInterface` for compatibility.
What are the supported Laravel and PHP versions?
The package supports PHP 7.4–8.1 and is compatible with Laravel 8–9. For Laravel 10+, check for breaking changes in the RabbitMQ or Symfony dependencies, as the package is no longer actively maintained.
How do I configure RabbitMQ for async event dispatching?
Initialize the `RabbitMQDriver` with your connection details (host, port, credentials) and register it with the dispatcher. Example: `$driver = new RabbitMQDriver(['host' => 'localhost']); $ed->addDriver($driver, 'event.name');`
Is the file driver suitable for production use?
No, the file driver is only for development or testing. It lacks reliability guarantees (race conditions, disk I/O bottlenecks) and isn’t designed for production workloads.
How do I handle failed async events (e.g., RabbitMQ connection issues)?
The package doesn’t include retry logic or dead-letter queues. Wrap the dispatcher in a custom retry mechanism or use Laravel’s queue system alongside it for error handling.
Can I create a custom driver (e.g., for Redis or Kafka)?
Yes, implement the `AsyncEventDriverInterface` and register it with the dispatcher. Example: `$driver = new RedisDriver(); $ed->addDriver($driver, 'event.name');`
What’s the performance impact of async event dispatching?
Async dispatching reduces request latency by offloading work to background processes (RabbitMQ). Throughput depends on your driver (e.g., RabbitMQ can handle thousands of events/sec), but test under load for your specific use case.
How do I migrate from synchronous to async events in Laravel?
Start with non-critical events (e.g., `UserRegistered`). Implement `AsyncEventInterface`, register the dispatcher, and gradually replace `Event::dispatch()` calls. Use feature flags to parallelize sync/async dispatch during migration.
Are there alternatives to AsyncEventDispatcher for Laravel?
Yes, consider Laravel’s built-in queues (with `dispatch()`) or packages like `spatie/laravel-queueable-events` for event-to-job conversion. This package is niche—best for pub/sub patterns where queues aren’t ideal.
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.
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony
spatie/flare-daemon-runtime