symfony-bundles/event-queue-bundle
Symfony bundle for queueing and asynchronously processing application events. Decouple event producers from listeners, defer work to background workers, and build scalable event-driven workflows with straightforward Symfony integration.
composer require symfony-bundles/event-queue-bundle, then add the bundle to AppKernel (or bundles.php on Symfony 4). This package predates Flex, so there is no recipe — you wire the bundle manually.DependencyInjection/Configuration.php first. The package is small and lightly documented; the config tree in Configuration.php is the fastest way to learn which transport, connection, and consumer options are actually supported. Do not assume it wraps Enqueue or Symfony Messenger — it is its own thin abstraction.composer.json before committing. Last release is 2017-10-17, so it targets Symfony 3.x/early 4.x and PHP 7.0/7.1 era. Verify constraint compatibility before pulling it into a current project.dispatch(new Job) — except here you are queuing events that Symfony’s EventDispatcher later fans out to listeners.event-queue:consume or similar) by running bin/console list. That command is your worker and the thing you will run under supervisor/systemd in production.$dispatcher->dispatch('order.placed', $event) with a call that pushes the event onto the configured queue. Keep the event class a plain serializable DTO — no entities, no service handles, no closures. Store IDs and re-fetch on the consumer side.EventDispatcher. Listeners registered normally (services tagged kernel.event_listener) then run against the queued event. This means your listener code does not change — only the dispatch path does.EventQueuePublisher wrapper in your app so call sites never touch the bundle’s internals directly. If you later migrate to Symfony Messenger or Enqueue, you swap one class.%env(...)%.test env so unit and functional tests never touch a broker. Have your publisher interface mocked in listener tests; have the consumer tested separately with a fixed fixture message.--time-limit or equivalent (if supported) and --memory-limit if the bundle exposes it. Wrap with restart policy. This is exactly how you would run php artisan queue:work.orders, billing) so a backlog in one domain does not stall another.EventDispatcher, you can keep synchronous listeners for latency-sensitive work and only queue the fan-out listeners (analytics, notifications, audit). Do not queue everything — queued events are eventually consistent and harder to trace.AppKernel conventions; Symfony 5+ changed EventDispatcherInterface signatures (dispatch($event, $name) argument order). This bundle predates those changes — expect fatal errors on modern Symfony until you audit the dispatch calls.\DateTime subclasses without timezone handling, and objects holding EntityManager references will deserialize badly. Use scalar DTOs and re-fetch entities by ID in listeners.--memory-limit, use it; otherwise restart workers periodically via supervisor.Configuration.php rather than the README. In particular, confirm the default transport name and whether the dispatcher path is overridden globally — a careless config can silently route all events through the queue.EventPublisher interface on day one. That keeps the exit to Symfony Messenger a one-file change when you inevitably outgrow it.How can I help you explore Laravel packages today?