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 Orm Bridge Laravel Package

dlakomski/doctrine-orm-bridge

Doctrine ORM bridge for SimpleBus/MessageBus. Provides command bus middlewares to wrap command handling in database transactions and to dispatch domain events generated by Doctrine entities. Links to main SimpleBus repo for issues and PRs.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Event-Driven Architecture (EDA) Integration: Enables seamless integration of domain events with Doctrine ORM, allowing teams to adopt CQRS (Command Query Responsibility Segregation) or event sourcing patterns without reinventing the wheel. This aligns with roadmaps prioritizing scalability, decoupling, and real-time data processing.
  • Transaction Management for Commands: Supports wrapping command execution in database transactions, reducing boilerplate code for handling rollbacks and ensuring data consistency. Ideal for financial, inventory, or workflow systems where atomicity is critical.
  • Build vs. Buy: Avoids custom development of event/command bus middleware, saving engineering time and reducing technical debt. The MIT license and minimal dependencies make it a low-risk "buy" decision.
  • Use Cases:
    • Order Processing Systems: Trigger domain events (e.g., OrderCreated, PaymentProcessed) after command execution (e.g., CreateOrderCommand).
    • Audit Logs: Automatically log entity changes via events without manual intervention.
    • Microservices: Decouple services by publishing events to a message bus (e.g., RabbitMQ, Kafka) while leveraging Doctrine for persistence.
    • Legacy System Modernization: Gradually introduce event-driven patterns into monolithic applications using Doctrine.

When to Consider This Package

  • Adopt When:

    • Your team uses Doctrine ORM and SimpleBus/MessageBus (or plans to) for command/event handling.
    • You need transactional command execution (e.g., "create order + update inventory" as a single atomic unit).
    • Domain events are critical for business logic (e.g., notifications, analytics, or downstream service triggers).
    • You want to avoid manual event collection (e.g., iterating over entity manager to find events post-save).
    • Your stack includes PHP/Laravel and you prioritize maintainability over custom solutions.
  • Look Elsewhere If:

    • You’re not using Doctrine ORM (e.g., Eloquent, MongoDB, or another ORM).
    • Your event/command bus is already integrated with another solution (e.g., Symfony Messenger, Laminas EventManager).
    • You need advanced event sourcing (e.g., storing events as first-class citizens; this package focuses on in-memory event handling).
    • Your team lacks PHP/Doctrine expertise—this package requires understanding of both SimpleBus and Doctrine’s lifecycle.
    • You’re in a high-throughput environment where event processing latency is a bottleneck (this package is lightweight but not optimized for async bulk processing).

How to Pitch It (Stakeholders)

For Executives:

*"This package lets us leverage event-driven architecture without building custom infrastructure. By integrating Doctrine ORM with our command bus, we can:

  • Reduce bugs by ensuring commands run in transactions (e.g., no partial order updates).
  • Decouple services so teams can work independently (e.g., notifications team listens to OrderShipped events without tight coupling).
  • Save 3–6 months of dev time by avoiding reinventing event/command middleware. It’s a low-risk, high-reward choice—MIT-licensed, battle-tested in PHP ecosystems, and used by teams building scalable systems like ours. The upfront cost is minimal; the long-term benefits are significant for maintainability and growth."*

For Engineering:

*"This bridge solves two key pain points:

  1. Transactional Commands: No more manually wrapping Doctrine operations in try/catch blocks. The package handles rollbacks automatically if a command fails (e.g., CreateOrderCommand + ReserveInventoryCommand).
  2. Effortless Domain Events: Entities can dispatch events (e.g., ProductStockUpdated) during lifecycle callbacks, and the bridge publishes them to the bus—without manual collection. This is especially useful for:
    • Audit trails (log all entity changes).
    • Real-time updates (e.g., push UserRegistered to a frontend via WebSocket).
    • Cross-service communication (e.g., PaymentFailed event triggers a fraud alert).

Why not build it?

  • Proven: Used in production by the SimpleBus team (though niche, it’s battle-tested).
  • Minimal overhead: ~50 lines of config + middleware setup.
  • Future-proof: Aligns with CQRS/event sourcing trends.

Trade-offs:

  • Requires Doctrine ORM (not Eloquent or raw SQL).
  • Events are processed synchronously (not async like Kafka consumers).

Next Steps:

  1. Spike: Integrate with a single command/event pair in staging.
  2. Benchmark: Compare performance vs. custom solution (likely negligible diff).
  3. Adopt incrementally: Start with critical workflows (e.g., orders, payments)."*
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.
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours