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

Doctrine Value Object Laravel Package

yokai/doctrine-value-object

yokai/doctrine-value-object brings reusable value objects to Doctrine in Laravel apps, offering embeddable types and integration helpers for cleaner, type-safe domain models with less boilerplate.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • The package is oriented at Doctrine ORM, not Eloquent. In a Laravel codebase that is a material constraint: it only fits teams that have deliberately adopted Doctrine (typically via laravel-doctrine) for a DDD-style domain layer. Eloquent-first applications get zero value.
  • It targets a legitimate seam: value objects (Money, Email, UUIDs, ranges, identifiers) need DBAL types and/or embeddables to round-trip cleanly. The package compresses that boilerplate into base classes and type registration.
  • The abstraction is narrow and structural rather than framework-coupled—low conflict risk with existing Laravel service providers, but also low leverage outside Doctrine-mapped aggregates.

Integration feasibility

  • Technically low-friction: add doctrine/orm + doctrine/dbal, extend a base value object, register a DBAL type or map as an embeddable. No invasive wiring.
  • The real feasibility question is organizational: does the team already run Doctrine in production? If yes, this is a small, contained improvement. If no, adopting this package means adopting Doctrine—a much larger decision that should not be driven by value-object ergonomics.
  • No dependents and 13 stars imply the integration path is lightly trodden; expect to read source and write your own tests rather than find battle-tested recipes.

Technical risk

  • Bus factor: single small maintainer, negligible community, zero dependent packages. Treat as unmaintained-by-default.
  • Version drift: last release 2024-07-08. Doctrine DBAL 4 / ORM 3 introduced breaking changes around types and embeddables; compatibility is unverified and is the top blocker to confirm.
  • Correctness surface: value-object persistence is deceptively subtle—nullability, equals() semantics, hydration of nested/composite VOs, and type conversion failures tend to surface as silent data bugs rather than exceptions.
  • Mitigation: vendor or fork. The code surface is small enough that a fork is cheap insurance, which lowers the risk considerably if the team accepts ownership.

Key questions

  1. Does it support the Doctrine ORM/DBAL versions we would actually pin?
  2. Does it handle nullable and composite (embeddable) value objects, and what are the hydration failure modes?
  3. What is the test coverage, and can we run it against our DB platform (MySQL/Postgres)?
  4. Are we prepared to own a fork if the upstream goes quiet?
  5. Do we have Doctrine expertise on the team, or is this a pattern we would be importing without the supporting skills?

Integration Approach

Stack fit

  • Best fit: Laravel + Doctrine, PHP 8.1+, DDD-leaning domain layer with a bounded set of value objects (identifiers, money, email, date ranges).
  • Poor fit: Eloquent-centric applications, CRUD services, teams without Doctrine experience.
  • Complementary, not competing, with existing casts/embedded patterns—introduce alongside rather than as a wholesale replacement.

Migration path

  • Incremental and per-aggregate. Do not retrofit the whole domain.
  • Pilot on one bounded context and one or two value-object types where correctness is easy to assert (e.g., an Email or OrderId).
  • Prefer registering custom DBAL types for scalar VOs and embeddables for composite VOs; keep the package's base classes as thin scaffolding, not as the domain's inheritance root.
  • If upstream compatibility is unresolved, fork into an internal namespace and pin—treat it as vendored code from day one.

Compatibility

  • Confirm PHP version, Doctrine ORM/DBAL constraints, and DB platform support before committing.
  • Check interaction with laravel-doctrine metadata drivers and caching; type registration must happen before entity metadata is warmed.
  • Validate against the ORM's schema tooling to ensure generated migrations match persisted representations.

Sequencing

  1. Spike: verify Doctrine version compatibility and run the package's tests against our stack.
  2. Pilot: one bounded context, one or two VOs, with round-trip and nullability tests.
  3. Decide: adopt as-is, fork-and-pin, or implement equivalent thin base classes in-house (often the cheapest option given the small surface).
  4. Expand: roll out per aggregate only after the pilot proves hydration and schema behavior.

Operational Impact

Maintenance

  • Expect to own it. With no dependents and a single maintainer, upstream fixes for Doctrine upgrades are unlikely to arrive on our timeline.
  • Budget for a fork-and-patch workflow and a documented internal owner; the code is small, so ongoing cost is low but non-zero.

Support

  • Community-only, effectively no support channel. Ramp-up depends on internal Doctrine expertise rather than documentation.
  • Keep an internal README documenting our pinned version, fork rationale, and the specific VOs in use.

Scaling

  • No runtime scaling concerns: this is a design-time mapping concern, not a throughput one. Performance is bounded by Doctrine's hydration and DBAL type conversion, which the package does not materially change.
  • Organizational scaling is the real constraint—the pattern is only consistent if the team shares conventions for VO equality, nullability, and serialization.

Failure modes

  • Silent mis-hydration of value objects (wrong type, lost immutability, nulls collapsing to defaults).
  • DBAL type registration conflicts or ordering issues causing intermittent mapping failures across environments.
  • Breakage on Doctrine major upgrades with no upstream fix.
  • Schema/tooling drift when embeddable column naming conventions are not pinned.
  • Knowledge concentration: one engineer understands the mapping, and the pattern erodes when they leave.

Ramp-up

  • Moderate for Doctrine-fluent teams, steep for Eloquent-only teams—not because the package is complex, but because the surrounding Doctrine/DDD concepts are.
  • Recommend a short internal guide and a lint/test rule (round-trip tests per VO) to prevent regressions.

Recommendation: Low strategic value, contained technical risk if forked and pinned. Adopt only where Doctrine is already the persistence layer and the team accepts ownership; otherwise implement the equivalent thin base classes directly, which is likely cheaper than carrying an unmaintained dependency.

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.
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast