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

Domain Events Laravel Package

cvek/domain-events

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Event-Driven Architecture (EDA) Adoption: Enables seamless integration of domain events into Symfony/Laravel applications, supporting a shift toward event-driven workflows (e.g., order processing, notifications, or analytics pipelines).
  • Decoupling Business Logic: Facilitates loose coupling between services by allowing entities to emit events without direct dependencies on consumers (e.g., decoupling payment processing from inventory updates).
  • Async Processing for Scalability: Mitigates performance bottlenecks by offloading non-critical tasks (e.g., sending emails, logging, or third-party API calls) to async handlers, improving response times.
  • Doctrine Agnosticism: Aligns with roadmap goals to abstract persistence layers, enabling easier migration between ORMs (e.g., Doctrine ↔ Eloquent) or database backends.
  • Build vs. Buy: Justifies buying this package over custom development for teams lacking event-driven expertise, reducing technical debt while accelerating feature delivery.
  • Use Cases:
    • Real-time notifications (e.g., Slack alerts on order status changes).
    • Audit trails (e.g., tracking entity state changes for compliance).
    • Cross-service communication (e.g., syncing inventory across microservices).
    • Background jobs (e.g., generating reports post-transaction).

When to Consider This Package

  • Adopt if:

    • Your app uses Symfony/Laravel with Doctrine and needs domain events for business logic separation.
    • You prioritize async processing for performance-critical paths (e.g., long-running tasks, external APIs).
    • Your team lacks mature event-driven patterns but wants to avoid reinventing the wheel.
    • You’re building modular services where entities should trigger actions without tight coupling.
    • You need pre/post-flush hooks for validation or side effects (e.g., soft deletes, triggers).
  • Look elsewhere if:

    • You’re not using Symfony/Laravel (package is Symfony-focused; Laravel alternatives like spatie/laravel-event-sourcing may fit better).
    • Your events are simple (e.g., Laravel’s built-in Event system suffices).
    • You require complex event routing (e.g., Kafka/RabbitMQ-native solutions like symfony/messenger).
    • Your async needs are heavyweight (e.g., distributed transactions; consider symfony/messenger with Doctrine transport).
    • You’re not using Doctrine (package relies on Doctrine events; Eloquent users may need alternatives).
    • Your team prefers reactive streams (e.g., RxPHP) over event sourcing.

How to Pitch It (Stakeholders)

For Executives:

*"This package lets us decouple business logic from infrastructure, enabling faster feature delivery and scalability. For example, when a user places an order, we can:

  • Instantly trigger inventory updates (sync).
  • Asynchronously send confirmation emails or log analytics (async). This reduces latency, cuts costs (no over-provisioning), and future-proofs our architecture for microservices. It’s a low-risk, high-reward investment—MIT-licensed, actively maintained, and used by teams building complex event-driven systems."*

For Engineering:

*"Problem: Our current event system is tightly coupled to Doctrine, making it hard to:

  • Offload async tasks without blocking requests.
  • Swap ORMs or databases later.
  • Reuse events across services cleanly.

Solution: This package gives us: ✅ Three event types (preFlush, onFlush, postFlush) for precise control over timing. ✅ Async support via Doctrine transport—no extra infrastructure needed (unlike Symfony Messenger). ✅ Doctrine-agnostic design—easy to port if we switch ORMs. ✅ Battle-tested patterns (e.g., RaiseEventsTrait) to avoid boilerplate.

Trade-offs:

  • Symfony-first (but Laravel-compatible with minor tweaks).
  • Async relies on Doctrine storage (not a message broker).

Next Steps:

  1. Pilot: Use it for a non-critical feature (e.g., notifications).
  2. Benchmark: Compare async performance vs. current queue system.
  3. Integrate: Replace custom event listeners with this package’s traits/interfaces.

Ask: Can we allocate 2 sprints to evaluate and migrate a high-impact module?"*

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.
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
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle