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

Messenger Laravel Package

sulu/messenger

Symfony Messenger add-on for Sulu providing stamps and middlewares to configure the Sulu message bus. Includes UnpackExceptionMiddleware to surface real handler errors and LockMiddleware to prevent concurrent access. Usable standalone in any Symfony app.

View on GitHub
Deep Wiki
Context7

A symfony message bus with additional middleware used by Sulu CMS.

Frequently asked questions about Messenger
Can I use sulu/messenger in Laravel without Symfony?
Yes, but with caveats. The package is Symfony-first, so you’ll need to bridge it via spatie/laravel-messenger or wrap Symfony components (e.g., symfony/messenger) in Laravel services. Middlewares like LockMiddleware require custom adapters for Eloquent or Laravel’s queue system.
How do I integrate sulu/messenger with Laravel’s queue workers?
Use spatie/laravel-messenger to bridge Symfony’s Messenger to Laravel’s queue:work. Map Symfony transports (e.g., AMQP) to Laravel drivers (Redis, database) via custom adapters. Middlewares like UnpackExceptionMiddleware will work if you handle Laravel’s ShouldQueue exceptions.
What Laravel versions support sulu/messenger?
Direct support isn’t guaranteed, but it works with Laravel 10+ if you use spatie/laravel-messenger (v2.0+) as a bridge. Test with symfony/messenger:^6.4 for compatibility. For older Laravel versions, abstract Symfony dependencies carefully.
How does UnpackExceptionMiddleware improve error handling in Laravel?
It exposes the *real* exception from HandlerFailedException, letting you map failures to HTTP status codes (e.g., 422 for validation errors) or log them cleanly. In Laravel, extend it to handle native exceptions like Throwables or ShouldQueue failures.
Is LockMiddleware safe for production with Laravel’s Eloquent?
Not natively—it’s Doctrine-focused. For Eloquent, use symfony/lock with a database/file backend (e.g., Redis) or add an optimistic_lock column. Test lock TTLs (5–30s) to avoid deadlocks under high concurrency.
Will sulu/messenger slow down my Laravel queues?
Middlewares add minimal overhead, but LockMiddleware or DoctrineFlushMiddleware (if adapted) can block jobs if misconfigured. Profile with real workloads (e.g., 1000 RPS) and use short lock durations or selective flushing for critical entities.
Are there alternatives to sulu/messenger for Laravel?
Yes: spatie/laravel-queue-scheduler for job scheduling, laravel-horizon for monitoring, or symfony/messenger directly with custom Laravel wrappers. For locking, consider symfony/lock or Laravel’s native mutexes (e.g., file-based).
How do I test sulu/messenger middlewares in Laravel?
Use Laravel’s Queue::fake() for unit tests and Dockerized environments for integration tests with locks/Doctrine. Mock Symfony’s TestBus or adapt it to Laravel’s queue system. Test error paths by throwing exceptions in message handlers.
Can I use sulu/messenger without the SuluMessengerBundle?
Yes, the package provides standalone stamps/middlewares. Skip the bundle if using Laravel and install only sulu/messenger via Composer. Configure middlewares manually in your Laravel service provider or spatie/laravel-messenger setup.
What’s the effort to adapt DoctrineFlushMiddleware for Eloquent?
Moderate. You’d need to create a custom middleware wrapping Eloquent’s flush() or save() methods, then integrate it into Laravel’s queue lifecycle (e.g., via queue:after hooks). Test thoroughly for transaction boundaries.
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.
anousss007/vigilance
supportpal/eloquent-model
ardenexal/fhir-models
laravel-at/laravel-image-sanitize
romalytar/yammi-audit-log-laravel
ardenexal/fhir-validation
arshaviras/weather-widget
laravel-chronicle/core
sunchayn/nimbus
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon