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 Bundle Laravel Package

andy-thorne/domain-events-bundle

View on GitHub
Deep Wiki
Context7

Symfony Domain Events Bundle

This bundle adds Domain Event dispatching on doctrine events via a MessageBus.

CI

Installation

composer require andy-thorne/domain-events-bundle

Configuration

# Defaults
domain_events:
    orm: true
    odm: false
    bus: domain_event.bus
    transport: async_domain_events
    configure_routing: true  # Auto-configures messenger routing for DomainEventInterfaces to route to the configured transport

framework:
    messenger:
        transports:
            async_domain_events: "%env(ASYNC_MESSENGER_TRANSPORT_DSN)%"

The bundle will also configure these messenger settings based on your domain_events config. If you already have buses configured, you will need to specify a framework.messenger.default_bus.

# The bundle also configures your
framework:
    messenger:
        # Set up a bus that will allows no handlers
        buses:
            <domain_events.bus>:
                default_middleware: allow_no_handlers

        # Route all domain events to the domain event transport if configure_routing is true (default)
        routing:
            'AndyThorne\Components\DomainEventsBundle\Events\DomainEventInterface': <domain_events.transport>

Message Bus

Domain Events uses the app's MessageBus to transport domain events. The default Messenger Component is configured to be synchronous and requires at least one handler to be defined for each Message. For Domain Events to work, we need to configure an asynchronous MessageBus and allow it to have no handlers:

Why Asynchronous?

Domain Events are dispatched within a doctrine postFlush lifecycle event

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.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor