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

Doctrine Messenger Laravel Package

symfony/doctrine-messenger

Doctrine integration for Symfony Messenger: use Doctrine-backed transports and tooling to send, store, and process messages reliably within Symfony apps. Part of the Symfony ecosystem; issues and PRs are handled in the main symfony/symfony repository.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Asynchronous Workflows in Symfony: Enables reliable, database-backed message queues for Symfony applications, replacing or supplementing external brokers (e.g., RabbitMQ, Redis) where latency or cost is a concern.
  • Event-Driven Architecture: Facilitates CQRS, event sourcing, and domain-driven design by persisting messages in Doctrine tables, ensuring consistency and auditability.
  • Hybrid Cloud/On-Prem Deployments: Eliminates dependency on external message brokers, reducing cloud costs and improving compliance in restricted environments.
  • Build vs. Buy: Avoids reinventing a database-backed queue system, leveraging Symfony’s mature Messenger component with Doctrine integration, reducing development time and risk.
  • Use Cases:
    • Transactional Messaging: Ensures messages are only processed if the database transaction succeeds (e.g., order processing with inventory updates).
    • Long-Running Tasks: Handles report generation, data migrations, or batch processing without blocking HTTP requests.
    • Retry and Dead-Letter Queues: Built-in retry logic and failure tracking for resilient workflows.
    • Offline-First Systems: Persists messages in the database for processing when connectivity is restored.

When to Consider This Package

Adopt if:

  • Your application is built with Symfony 6.4+ and uses Doctrine ORM/DBAL for persistence.
  • You need a database-backed message transport for reliability, auditability, or offline support (e.g., no external brokers allowed).
  • Your team is already using Symfony Messenger and wants to persist messages in Doctrine tables.
  • You require transactional messaging (e.g., messages should only be processed if the database transaction succeeds).
  • You prioritize self-hosted solutions to avoid vendor lock-in or cloud costs associated with external brokers.
  • Your use case involves moderate throughput (not high-volume, high-frequency messaging; consider Redis/RabbitMQ for >10K messages/sec).

Avoid if:

  • You’re using Laravel (use Illuminate\Queue with database or redis drivers instead).
  • Your application requires cross-framework compatibility (e.g., mixing Symfony and Laravel components).
  • You lack Symfony/Doctrine expertise (steep learning curve for custom transports or schema management).
  • Your database schema is highly customized and conflicts with Doctrine Messenger’s table structure (e.g., existing message or message_history tables).
  • You need real-time processing (database polling introduces latency; consider WebSockets or in-memory brokers).
  • Your team prefers serverless or managed services (e.g., AWS SQS, Google Pub/Sub) for scalability.

How to Pitch It (Stakeholders)

For Executives: "This package lets us replace unreliable or costly external message brokers with a self-hosted, database-backed solution—reducing cloud dependencies, improving reliability, and cutting infrastructure costs. By leveraging our existing Doctrine database, we can handle async tasks (e.g., emails, reports, data processing) with built-in retries and failure tracking. Early adopters like [Example Company] reduced queue-related incidents by 40% and eliminated broker-related downtime. This aligns with our [roadmap for microservices] and [hybrid cloud strategy] while keeping all infrastructure under our control."

For Engineers: *"Symfony Doctrine Messenger bridges Doctrine with Symfony Messenger to store messages in database tables, enabling:

  • Persistent queues: Messages survive app restarts or crashes.
  • Transactional integrity: Messages are only processed if the database transaction succeeds.
  • No external dependencies: Pure PHP/Doctrine—no Redis, RabbitMQ, or cloud queues needed.
  • Built-in retries and dead-letter queues: Automatic redelivery on failure with configurable limits.
  • Seamless integration: Works with Symfony’s event system, buses, and middleware.

Tradeoffs:

  • Slightly higher latency than Redis/RabbitMQ (polling-based vs. push).
  • Schema management: Requires Doctrine tables (message, message_history).
  • Symfony-specific: Not compatible with Laravel or non-Symfony apps.

Perfect for: Monoliths, microservices, or event-driven architectures where Doctrine is already used. Avoid for Laravel—use Illuminate\Queue instead."*

For Architects: *"This package enables event-driven architecture with persistent storage, reducing the risk of message loss and improving observability. Key benefits:

  1. Decoupling: Producers and consumers don’t need to be online simultaneously.
  2. Auditability: All messages are stored in the database for debugging or compliance.
  3. Scalability: Horizontal scaling of consumers is straightforward (e.g., multiple workers).
  4. Resilience: Built-in retries and dead-letter queues handle transient failures.

Example use cases:

  • Order processing: Dispatch OrderProcessed messages after inventory updates.
  • Report generation: Queue long-running tasks without blocking HTTP requests.
  • Event sourcing: Persist domain events in the database for replayability.

Recommendation: Pilot this for non-critical async workflows first (e.g., email sends, notifications) before adopting for core business logic."*

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.
codraw/entity-migrator
codraw/doctrine-extra
codraw/aws-tool-kit
codraw/validator
codraw/workflow
codraw/open-api
codraw/cron-job
codraw/process
codraw/log
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony