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

somnambulist/domain

Domain-driven design building blocks for Laravel and PHP: UUIDs, value objects, entities, aggregates, domain events, commands and repositories. A clean, framework-friendly foundation for modelling business logic with clear boundaries.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy for domain primitives. Every DDD-leaning Laravel service ends up writing the same scaffolding: base entity, aggregate root, value objects, UUID identifiers, timestamps, soft deletes, and a domain-event collector that flushes events only after persistence succeeds. This package is a ready-made version of that scaffolding under MIT, so the decision shifts from "which senior engineer spends three weeks building it" to "do we adopt, vendor, or fork it."
  • Roadmap sequencing for a bounded context. It lets you ship a modular monolith with rich domain models now and defer a full event-sourcing platform until the domain justifies it. The versioning and event-collection primitives are the seam you'd grow into event sourcing later without rewriting entities wholesale.
  • Whether to make domain events a first-class product capability. If your roadmap includes audit trails, outbound integration events, webhooks, or async workflows, aggregate-recorded domain events are the mechanism. This package makes "raise an event inside the aggregate, dispatch after commit" a convention rather than a bespoke feature.
  • Feature scoping for greenfield services. Good fit when a new service has genuine invariants and behavior (pricing, entitlements, billing, order lifecycle) rather than CRUD. Poor fit for admin panels and reporting screens, where Eloquent alone is cheaper.
  • Standardization across teams. A shared set of base classes creates reviewable conventions — where events are raised, how IDs are generated, how aggregates are versioned — which is a product-quality lever for consistency and onboarding, not just an engineering nicety.

When to Consider This Package

Adopt when:

  • You are committing to DDD or a DDD-lite approach in at least one bounded context, and the team can articulate aggregates, invariants, and domain events without hand-holding.
  • You need aggregate-scoped domain events dispatched transactionally, and you want that pattern consistent across services.
  • You want value objects, UUID identities, timestamps, and optimistic versioning without owning that code.
  • You are on PHP/Laravel and comfortable pinning a small dependency.

Look elsewhere, or plan to fork, when:

  • Adoption risk is unacceptable. 26 stars and zero dependents means no community safety net, no CVE-watching crowd, and a single-maintainer bus factor. Treat it as an internal library: vendor it, pin it, and assign an owner. If your organization cannot absorb that, build the 300 lines yourself.
  • You need real event sourcing. Projections, snapshots, replay tooling, and upcasters belong to EventSauce, Broadway, or Spatie's event-sourcing package. This is the modeling layer, not the platform.
  • The team is new to DDD. These abstractions add ceremony; without shared vocabulary they become indirection that slows delivery and confuses code review.
  • The domain is CRUD. Eloquent models, form requests, and policies are the correct answer; adopting aggregates here is résumé-driven architecture.
  • You are framework-agnostic. The package leans into Laravel's dispatcher and container; pure-PHP projects should prefer EventSauce's framework-neutral primitives.

How to Pitch It (Stakeholders)

To executives: This is a small MIT-licensed library that supplies the standard building blocks for modeling complex business domains — the parts every team rewrites and gets subtly wrong. Adopting it compresses the ramp-up on a new service by weeks and makes domain events, audit trails, and future async workflows a design convention rather than a bespoke project. There is no license cost and no vendor lock-in: worst case, we fork it internally. The real cost is maintenance ownership of a low-traffic dependency, which we mitigate by pinning the version and assigning a named owner.

To engineering leadership: It gives us consistent, testable primitives — aggregate roots that record events, value objects, UUID identifiers, versioning — so domain logic stays free of framework and persistence concerns, and events fire only after a successful commit. It is a modeling toolkit, not an event-sourcing platform; if we later need projections and replay, we graduate to EventSauce or Spatie and keep most of our domain code.

To the delivery team: Use it where it earns its keep — one or two bounded contexts with real invariants. Do not apply it to CRUD surfaces. Budget a short spike to read the source, since documentation and community examples are thin. If the spike raises concerns, the fallback is a small in-house package with the same surface area.

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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console