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

Eventsauce Outbox Laravel Package

andreo/eventsauce-outbox

Extended outbox components for EventSauce on PHP 8.2+. Includes an outbox-aware aggregate repository, a forwarding message consumer to dispatch to your queue, and a Symfony Console command to consume relays with batch/commit, sleep, and limit options.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Event-Driven Architecture (EDA) Expansion: Enables reliable, asynchronous event dispatching from Laravel applications using EventSauce, reducing message loss and ensuring eventual consistency across microservices. Critical for systems requiring decoupled event processing (e.g., order processing, notifications, or analytics pipelines).
  • Decoupling and Scalability: Supports horizontal scaling by separating event production (Laravel) from consumption (queues/APIs), avoiding blocking calls and improving resilience.
  • Roadmap for Microservices: Aligns with a service-oriented architecture (SOA) where events must be reliably published to downstream services without tight coupling. Ideal for domain-driven design (DDD) implementations.
  • Build vs. Buy: Avoids reinventing the outbox pattern from scratch, leveraging a lightweight, EventSauce-specific extension while mitigating risks of custom implementations (e.g., transaction handling, retries).
  • Use Cases:
    • Eventual Consistency: Ensures events are persisted in the outbox before dispatch, preventing data loss during failures.
    • Retry Mechanisms: Built-in support for retrying failed dispatches (via the outbox pattern), reducing manual intervention for transient errors.
    • Auditability: Tracks dispatched messages for debugging, compliance, or replayability (e.g., for debugging failed transactions).
    • Batch Processing: Optimizes performance with configurable batch sizes for message retrieval and commits, reducing database load.
    • Hybrid Architectures: Bridges Laravel’s ecosystem (e.g., queues, Artisan) with EventSauce’s event sourcing, enabling gradual adoption of EDA patterns.

When to Consider This Package

  • Adopt When:

    • Your Laravel application uses or plans to adopt EventSauce for event sourcing/CQRS and needs a reliable outbox pattern for message dispatching.
    • You require asynchronous event processing (e.g., publishing to Kafka, RabbitMQ, HTTP endpoints, or Laravel queues) without blocking the main application flow.
    • Fault tolerance is critical (e.g., retries, dead-letter queues for failed dispatches) and you want to avoid custom implementations.
    • Your team is comfortable with PHP 8.2+ and can handle Symfony integration (or abstract it for Laravel).
    • You prioritize eventual consistency over real-time processing (e.g., for analytics, notifications, or background jobs).
    • The package’s lightweight nature (no heavy dependencies) aligns with your preference for minimal overhead.
  • Look Elsewhere When:

    • You’re not using EventSauce and need a generic outbox solution (consider spatie/laravel-outbox or laravel-event-sourcing).
    • Your stack doesn’t include PHP 8.2+ or Symfony compatibility is a blocker (e.g., legacy Laravel versions).
    • You require real-time event processing (e.g., WebSocket updates, pub/sub) instead of eventual consistency.
    • Your team lacks experience with EventSauce, outbox patterns, or Symfony integration, and the learning curve is prohibitive.
    • You need built-in support for specific message brokers (e.g., AWS SQS, Google Pub/Sub) without additional configuration (this package is broker-agnostic).
    • The package’s maturity (low adoption, minimal documentation) is a concern for production-critical systems. Consider alternatives like:
      • Custom outbox implementation (for full control).
      • Laravel-native packages (e.g., spatie/laravel-outbox + EventSauce adapters).
      • EventSauce’s built-in outbox (if available in future versions).

How to Pitch It (Stakeholders)

For Executives:

"This package extends our EventSauce-based event sourcing with a reliable outbox pattern, ensuring events are safely dispatched to downstream systems even during failures. It decouples event production from consumption, improving scalability and fault tolerance—critical for our microservices roadmap. By leveraging this lightweight solution, we avoid reinventing the wheel, reduce technical debt, and enable eventual consistency for use cases like order processing, notifications, and analytics. The Symfony dependency is manageable (via abstraction or bridge), and the package’s focus on reliability aligns with our goals for resilient, asynchronous workflows."

For Engineering:

*"The eventsauce-outbox package provides:

  • Outbox pattern integration for EventSauce, ensuring messages are persisted before dispatch (critical for fault tolerance).
  • Asynchronous processing via a Symfony command (andreo:eventsauce:message-outbox:consume), with configurable batch sizes, retries, and sleep intervals. We’d need to adapt this for Laravel’s Artisan or use a Symfony bridge.
  • Decoupled message dispatching to queues/APIs, reducing coupling between services. Works with Laravel’s queue system via a custom adapter.
  • Lightweight and extensible: Built on EventSauce’s ecosystem, with support for custom relays and logging. Tradeoffs:
  • Symfony dependency: Requires abstraction (e.g., replace ServiceLocator with Laravel’s container) or a bridge.
  • Early-stage adoption: Low stars/dependents mean we’d need to monitor stability and potentially contribute.
  • Transaction management: Must sync Laravel’s transactions with EventSauce’s to avoid inconsistent state. Recommendation: Proceed if we’re committed to EventSauce + EDA. Otherwise, consider a Laravel-native outbox package with EventSauce adapters."*

For Developers:

*"Here’s how you’d use this in Laravel:

  1. Set up EventSauce as your event store and message dispatcher.
  2. Replace Symfony’s ServiceLocator with Laravel’s container or a custom locator for the outbox repository.
  3. Bridge EventSauce’s MessageDispatcher to Laravel’s queue system (e.g., using a custom adapter to forward events to Illuminate\Bus\Dispatcher).
  4. Rewrite the Symfony console command as an Artisan command or use a Symfony bridge (e.g., symfony/console via Composer).
  5. Configure the outbox consumer with your queue relay (e.g., foo-relay-id) and run it via Artisan:
    php artisan andreo:eventsauce:message-outbox:consume foo-relay-id --batch-size=50
    

Key gotchas:

  • Transactions must span both Laravel and EventSauce to avoid partial dispatches.
  • The outbox table schema may need adjustments for Laravel migrations.
  • Serialization/deserialization is your responsibility when bridging to Laravel queues."*
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