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

Ddd Laravel Package

pccomponentes/ddd

Mini framework PHP para construir aplicaciones con DDD + CQRS + Event Sourcing, orientado a la escritura. Propone arquitectura hexagonal (Application/Domain/Infrastructure/EntryPoint/Util) y guía de capas, dependencias y persistencia basada en eventos.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Architectural Modernization: Enables adoption of Hexagonal Architecture + DDD + CQRS/ES in Laravel projects, reducing technical debt by enforcing clean separation of concerns (Domain, Application, Infrastructure layers). Aligns with microservices or modular monolith roadmaps.
  • Event-Driven Systems: Supports Event Sourcing for auditability, temporal queries, and complex domain modeling (e.g., financial transactions, healthcare records). Critical for compliance (GDPR, SOX) and debugging.
  • Asynchronous Scalability: Facilitates CQRS separation (write/read models) via event queues (RabbitMQ), improving performance for read-heavy APIs (e.g., dashboards, analytics).
  • Build vs. Buy: Avoids reinventing DDD/ES infrastructure (e.g., custom event stores, repositories) while providing Laravel-native tooling (e.g., EntryPoint for dependency injection).
  • Use Cases:
    • High-cohesion domains (e.g., e-commerce order processing, SaaS multi-tenancy).
    • Regulated industries needing immutable audit trails (e.g., banking, legal).
    • Real-time systems where eventual consistency is acceptable (e.g., IoT, gaming leaderboards).

When to Consider This Package

Adopt When:

  • Your Laravel app requires complex domain logic that outgrows MVC (e.g., business rules spanning multiple tables).
  • You need Event Sourcing for:
    • Temporal queries (e.g., "Show all user actions in Q1 2024").
    • Immutable history (e.g., blockchain-like ledgers, versioned documents).
    • Offline-first sync (e.g., mobile apps with conflict resolution).
  • CQRS is a priority to decouple read/write models (e.g., Elasticsearch projections for fast searches).
  • Your team lacks DDD/ES expertise but wants scaffolding (e.g., pre-built AggregateRoot, DomainEvent classes).
  • You’re building a modular monolith or microservices with bounded contexts (e.g., Orders, Payments as separate domains).

Look Elsewhere When:

  • Simplicity is key: For CRUD apps, Laravel’s Eloquent + Queues suffice without DDD overhead.
  • Strong consistency is required: Eventual consistency (e.g., stale reads) is unacceptable (e.g., real-time inventory systems).
  • Team lacks DDD maturity: Steep learning curve for ubiquitous language, aggregates, and event storming.
  • Legacy codebase: Refactoring to Hexagonal Architecture is risky without buy-in from all stakeholders.
  • Alternative frameworks fit better:
    • Symfony (for enterprise DDD with Doctrine).
    • Node.js (for event-driven systems with libraries like EventStoreDB).
  • Performance-critical writes: Event Sourcing adds latency (e.g., appending events to a stream).

How to Pitch It (Stakeholders)

For Executives: *"This package lets us build scalable, maintainable Laravel apps using Domain-Driven Design—the gold standard for complex systems. Think of it as Laravel’s answer to microservices, but without the orchestration headache. For [Product X], it could:

  • Reduce bugs by encapsulating business logic in the Domain layer (no more scattered Eloquent models).
  • Future-proof the system for event-driven features (e.g., real-time notifications, audit trails).
  • Cut dev time by 30% for new modules (pre-built patterns for aggregates, commands, and events). Risk: Steeper initial setup, but pays off for teams of 5+ engineers. Let’s pilot it on [Y Module]."*

For Engineers: *"This is a DDD/ES framework-in-a-box for Laravel. Key wins:

  • Hexagonal layers: Forces clean separation (Domain → Application → Infrastructure). No more ‘fat models’ with DB logic.
  • Event Sourcing: Replace Model::update() with domain events (e.g., OrderPaid, InventoryReserved). Enables:
    • Time-travel debugging (replay events to see past states).
    • Projections (e.g., sync Elasticsearch via a worker).
  • CQRS: Write models (e.g., OrderAggregate) and read models (e.g., OrderView) evolve independently.
  • Tooling:
    • AggregateRoot handles invariants (e.g., ‘order total must match line items’).
    • CommandBus routes HTTP requests to domain logic. Tradeoff: More boilerplate upfront, but long-term maintainability wins. Start with a single bounded context (e.g., Payments)."*

For Architects: *"This addresses three critical pain points in Laravel monoliths:

  1. Anemic Domain Model: DDD forces rich entities (e.g., Order with calculateTotal()) instead of dumb data containers.
  2. Tight Coupling: Infrastructure (e.g., MySQL, Stripe) is abstracted behind interfaces (e.g., PaymentGateway).
  3. Scalability: Event Sourcing enables horizontal scaling (e.g., shard by event stream) and offline resilience. Red flags to watch:
  • Eventual consistency: Read models may lag writes (e.g., dashboard shows stale data).
  • Complexity: Requires event storming to model domains correctly. Recommendation: Use for new features, not greenfield projects—migrate incrementally by context."*
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
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