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

Laravel Event Projector Laravel Package

spatie/laravel-event-projector

Deprecated in favor of spatie/laravel-event-sourcing. Entry-level event sourcing toolkit for Laravel: define aggregates, projectors, and reactors; persist domain events, build read models, and react to events for auditing and reporting-friendly apps.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Event-Driven Architecture (EDA) Adoption: Enables teams to transition from traditional CRUD to event-driven workflows, improving scalability and auditability. Aligns with roadmaps for microservices or real-time systems.
  • Build vs. Buy: Avoids reinventing event sourcing infrastructure, reducing dev time and technical debt. Ideal for teams already using Laravel.
  • Use Cases:
    • Audit Trails: Track changes to critical data (e.g., financial transactions, user actions).
    • Real-Time Updates: Power live dashboards or notifications via projected state changes.
    • Data Reconciliation: Rebuild aggregates from historical events for consistency (e.g., after migrations or corruption).
    • Decoupled Services: Enable asynchronous processing between services via events.
  • Tech Stack Alignment: Leverages Laravel’s ecosystem (e.g., queues, Eloquent) for seamless integration with existing projects.
  • Future-Proofing: Migrates easily to spatie/laravel-event-sourcing (successor package), ensuring long-term viability.

When to Consider This Package

  • Adopt When:

    • Your team needs immutable audit logs or temporal queries (e.g., "Show me all user actions from last week").
    • You’re building scalable, stateful systems where traditional ORM patterns (e.g., direct DB updates) are limiting.
    • You require decoupled event processing (e.g., reactors for side effects like analytics or notifications).
    • Your Laravel project already uses queues or Eloquent, reducing integration friction.
    • You prioritize developer velocity over custom event-sourcing implementations.
  • Look Elsewhere If:

    • You need active maintenance: This package is archived; migrate to spatie/laravel-event-sourcing (v1+).
    • Your use case demands high-throughput event streaming (e.g., Kafka/SQS-native solutions like Laravel Serenity).
    • You’re not using Laravel: Consider framework-agnostic tools like EventStoreDB or Axon Framework.
    • Your team lacks event-sourcing maturity: Start with simpler patterns (e.g., Laravel Observers) before adopting event sourcing.
    • You need multi-model projections (e.g., GraphQL + event sourcing); this package focuses on SQL projections.

How to Pitch It (Stakeholders)

For Executives/Business Leaders

"This package lets us build systems where every change is recorded as an immutable event—like a blockchain for our business logic. For example, in [Use Case X], we can instantly reconstruct any past state of a critical record (e.g., a financial transaction) or trigger real-time updates to dashboards without manual syncs. It’s like adding a time machine to our data, reducing errors and enabling features like ‘undo’ or ‘roll back’ for high-stakes actions. The trade-off? A modest upfront investment in rethinking how we model data, but long-term gains in reliability and scalability. Oh, and it’s built for Laravel, so our existing team can adopt it quickly."

Key Outcomes:

  • Regulatory Compliance: Unchangeable audit trails for industries like finance/healthcare.
  • Operational Efficiency: Debugging and recovery become trivial (e.g., "What happened to Order #12345?").
  • Feature Velocity: Build real-time features (e.g., live collaboration tools) without custom infrastructure.

For Engineering/Technical Stakeholders

*"This is a battle-tested way to implement event sourcing in Laravel with minimal boilerplate. Here’s why it’s a no-brainer:

  • Aggregates: Model domain entities as event streams (e.g., UserAggregate emits UserRegistered, EmailVerified events).
  • Projectors: Materialize read-optimized views (e.g., UserProfile table) from events via SQL queries.
  • Reactors: Handle side effects (e.g., send welcome email when UserRegistered fires) with decoupled logic.
  • Laravel Native: Integrates with queues, Eloquent, and migrations—no foreign frameworks needed.

Migration Path: The package is archived but trivial to upgrade to spatie/laravel-event-sourcing. We’d start with a spike to validate:

  1. Performance (event replay speed for large datasets).
  2. Team onboarding (complexity of defining aggregates/projectors).
  3. Tooling gaps (e.g., testing event streams, handling schema migrations).

Alternatives: If we need more than SQL projections or active maintenance, we’d evaluate Laravel Serenity or build a custom solution—but this gives us 80% of the value with 20% of the effort."*

Tech Deep Dive:

  • Example Workflow:
    // Define an aggregate
    class UserAggregate {
        public function register(string $email) {
            $this->recordThat(new UserRegistered($email));
        }
    }
    
    // Project to a read model
    class UserProfileProjector {
        public function onUserRegistered(UserRegistered $event) {
            UserProfile::create([...]);
        }
    }
    
  • Trade-offs:
    • Complexity: Event sourcing requires discipline (e.g., handling event versioning, replaying streams).
    • Storage: Events accumulate over time (plan for DB growth).
    • Testing: Shift from unit tests to event replay tests.

Call to Action:

  • "Let’s prototype this for [High-Impact Use Case] in 2 weeks. If it delivers the auditability/real-time benefits we need, we’ll prioritize migrating to the successor package."
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport