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

enqueue/async-event-dispatcher

Symfony EventDispatcher extension that dispatches events asynchronously by sending them to a message queue, enabling background processing and improved responsiveness. Part of the Enqueue ecosystem; integrates with Symfony apps and supports MQ-driven event handling.

View on GitHub
Deep Wiki
Context7

[READ-ONLY] This an extension for Symfony's EventDispatcher. It allows to send events as MQ messages and process them async.

Frequently asked questions about Async Event Dispatcher
Can I use this package to offload Laravel events to a queue without rewriting my event listeners?
Yes, this package replaces Laravel’s default EventDispatcher with an async version, so your existing event listeners will work unchanged. Just ensure your events implement `JsonSerializable` or `Arrayable` for serialization. No code changes are needed beyond configuration.
What message brokers does this package support, and how do I configure them in Laravel?
The package supports RabbitMQ (via `php-enqueue/amqp-ext`) and Redis (via `php-enqueue/redis`). Configure your broker in Laravel’s `.env` using `QUEUE_CONNECTION=redis` or `QUEUE_CONNECTION=rabbitmq`, then bind the async dispatcher in your `AppServiceProvider`. The package leverages Laravel’s queue configuration.
Will this work with Laravel 10, or do I need to patch it?
The package was last updated in 2017 and may not fully support Laravel 10’s features (e.g., PSR-15). Test thoroughly, and consider forking or patching for compatibility. Monitor the GitHub repo for updates, or check the [Enqueue documentation](https://php-enqueue.github.io/) for workarounds.
How do I handle event failures or retries if the async processing crashes?
The package doesn’t include built-in retry logic, but you can integrate Laravel’s `ShouldQueue` interface with retries or use a `failed_jobs` table. For critical events, consider falling back to synchronous dispatch by checking `config('queue.default')` or using a hybrid approach with conditional dispatching.
Does this package add significant overhead to my deployment size?
Yes, the package requires `php-enqueue/amqp-ext` (~10MB) or `php-enqueue/redis` (~5MB) for transport, which increases your deployment footprint. If size is a concern, evaluate alternatives like Laravel Horizon or Symfony Messenger, which may offer more optimized solutions.
Can I mix async and synchronous event dispatching in the same Laravel app?
Yes, you can conditionally bind either the async or synchronous dispatcher in your `AppServiceProvider` based on environment variables or event type. For example, use async for non-critical events (e.g., analytics) and sync for critical paths (e.g., user authentication).
How do I test async events in Laravel unit tests?
Use Laravel’s `Queue::fake()` to mock the queue and assert events were dispatched. For example: `Queue::fake(); event(new MyEvent); Queue::assertPushed(MyEvent::class)`. This ensures your events are serialized correctly and sent to the queue without hitting a real broker.
Are there alternatives to this package that might be better suited for Laravel?
Yes, consider Laravel Horizon for advanced queue monitoring or Symfony Messenger for modern retry/transport support. Horizon integrates natively with Laravel’s queues and provides a dashboard, while Messenger offers better abstraction for complex event workflows. Choose based on your need for monitoring vs. simplicity.
How do I set up a worker process to handle async events?
Use Laravel’s built-in `queue:work` command to process async events: `php artisan queue:work`. For production, run it in the background with Supervisor or a process manager. Ensure your broker (Redis/RabbitMQ) is running and configured in `.env` with `QUEUE_CONNECTION`.
What happens if my event payload is too large for the queue (e.g., binary data or large arrays)?
The package serializes events to JSON, so large payloads may exceed queue limits (e.g., Redis’s 512MB default). For large data, offload processing to a separate service or use Laravel’s `ShouldQueue` with database-backed queues. Alternatively, store event IDs in the queue and fetch data via Eloquent.
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.
headercat/phpstan-extension-ide-helper
yosymfony/parser-utils
innmind/black-box
babenkoivan/elastic-migrations
babenkoivan/elastic-adapter
sandermuller/package-boost-php
sandermuller/boost-core
depa/sulu-google-reviews-bundle
croct/plug-symfony
develia/commons
dmstr/symfony-system-resources-bundle
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
renatomarinho/laravel-page-speed
develia/geo-bundle
austinheap/laravel-database-encryption
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
imbo/imbo-coding-standard