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.
Architecture fit. somnambulist/domain is a set of framework-agnostic DDD primitives rather than a Laravel package: abstract entities, aggregate roots, identity/UUID handling, value-object helpers, and domain-event plumbing. That makes it a reasonable fit for a Laravel codebase that is deliberately moving toward a domain layer above Eloquent (hexagonal-ish, bounded contexts). It is a poor fit if the team wants drop-in Laravel ergonomics — there is no service provider, no facade, and no opinion about Eloquent, so wiring is manual. The value proposition is consistency of building blocks (identity, event recording) across a team, not framework integration.
Integration feasibility. Composer-installable with a small dependency surface (likely ramsey/uuid and PHP ^8.x). Because the API is primitives-level, adoption can be incremental and local to one bounded context. Two practical gaps to verify in a spike: (1) how aggregate-recorded domain events are released and bridged into Laravel's event dispatcher, and (2) whether any persistence mapping helpers exist for Eloquent or whether you write mappers/casts yourself. MIT license removes legal friction and permits forking.
Technical risk. This is the weakest dimension. 26 stars, zero dependents, and a composite score of 0.19 indicate an unproven package with essentially no production reference base. The realistic risks are: single-maintainer bus factor; silent API churn across majors; breakage on PHP or ramsey/uuid upgrades; and no community answer pool when something behaves unexpectedly. The opportunity signal (10.89) is interesting but is not evidence of fitness — it reads as "undervalued primitives," not "battle-tested library." Treat this as a vendored utility or an internal pattern library, not a load-bearing dependency.
Key questions.
Stack fit. Best fit is a Laravel monolith that already has (or wants) an explicit domain layer: value objects for typed IDs and money/quantity, aggregate roots enforcing invariants, domain events for side effects. Eloquent remains the persistence mechanism; the package supplies the in-memory domain model. If the architecture is thin CRUD controllers over Eloquent, this package adds ceremony without payoff.
Migration path. Do not adopt wholesale. Start with the lowest-risk primitives — identity/UUID base classes and one or two value objects — in a single bounded context, and keep Eloquent models as-is. Add aggregate roots and domain-event recording only where a real invariant or cross-aggregate side effect exists. This keeps the blast radius to one module and gives a concrete go/no-go before broader commitment.
Compatibility. Verify PHP constraint against the runtime version and check whether the package's minimum PHP is stricter than Laravel's. Since there is no Laravel integration layer, compatibility is "works if the language level works." Budget for an internal adapter (event dispatcher bridge, exception-to-HTTP mapping) rather than assuming one exists.
Sequencing.
Maintenance. Low ongoing effort if the team uses a narrow slice, but the maintenance burden shifts to you: you own upgrade compatibility with PHP and ramsey/uuid, and you own any bug you hit. The small API surface makes pinning and patching practical. Forking under MIT is a realistic fallback and should be pre-agreed, not discovered during an incident.
Support. Effectively self-support. No dependents means no community troubleshooting corpus, no Stack Overflow answers, no third-party blog posts. Onboarding documentation must be internal. This is acceptable for a senior team and a poor choice for a team that leans on ecosystem support.
Scaling. The library itself is not a scaling concern — it is in-memory object modeling. Scaling risk is organizational: as more contexts adopt it, internal conventions (identity format, event naming, serialization) must be governed or you get divergent dialects. Establish a lightweight internal standard early.
Failure modes. Highest-probability failures: (1) domain events recorded on aggregates but never released, causing silently missing side effects; (2) value objects failing around queue serialization or Eloquent hydration; (3) a PHP or dependency upgrade breaking the package with no upstream patched release; (4) developers new to DDD misusing aggregate roots as anemic wrappers, generating complexity with no invariant enforcement. Each has a cheap mitigation: an integration test asserting event dispatch, an explicit serialization contract, a version pin with a documented fork procedure, and a short design-review checklist.
Ramp-up. The API is small; the real ramp-up cost is DDD fluency, not the package. Expect a few days for a senior developer to be productive and a short internal guide for the rest of the team. If the team lacks DDD experience, the package's abstractions will feel like overhead before they feel like leverage — sequence the pilot accordingly.
TPM recommendation. Proceed as a scoped spike, not a platform commitment. The architecture is aligned with a DDD-leaning Laravel codebase, but adoption signals are too weak to justify broad dependency. Approve the 1–2 day evaluation with an explicit fork-or-reimplement exit criterion, and gate wider rollout on the pilot surviving one upgrade cycle and one queue-based event flow.
How can I help you explore Laravel packages today?