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.
Money, Email, Address, DateRange, OrderId) directly in Doctrine entities instead of passing primitives around. This is a domain-modeling decision, not just a library choice.#[Embeddable] / #[Embedded] wiring and constructor/setter noise. Decision input: is this worth an external dependency, or is it ~100–200 lines we should own internally? At 13 stars and 0 dependents, "vendor or fork" is a legitimate third option alongside build/buy.Consider it when all of the following hold:
laravel-doctrine). If the stack is Eloquent, stop here — casts and custom cast classes already solve this.Look elsewhere (or don't adopt) when:
doctrine/dbal Type, not an embeddable — look at ramsey/uuid-doctrine or write a Type. Embeddables solve a different problem (composite values), and conflating them creates awkward schemas.#[Embeddable]/#[Embedded] already covers the happy path; a 20-line internal trait may be strictly better than an unmaintained package.Mitigation if adopted: fork into the org's VCS, pin the version, add contract tests around hydration/mapping, and assign an owner. Budget a small recurring maintenance line.
For executives (30 seconds): This is a small, free (MIT) utility that makes it cheaper for the engineering team to model core business concepts — money, emails, addresses, IDs — as proper typed objects instead of loose strings and floats, which reduces a class of data-integrity bugs. It is not a strategic bet and not a customer-facing feature; it's a quality-of-implementation lever with near-zero license cost. The main risk is that it's a tiny, single-maintainer open-source project, so we would fork it internally and own it rather than depend on it directly. Cost is a few engineering days, not a procurement cycle.
For engineering: It removes repetitive Doctrine embeddable mapping boilerplate so value objects drop into entities cleanly and consistently. It's a convention enforcer, not a framework. Caveats to state plainly: 13 GitHub stars, zero dependents, last release July 2024 — treat it as reference code, not a dependency. Recommended path: timebox a one-day spike against our actual Doctrine version, and if it earns its place, vendor the source into the repo with tests and an owner. If the spike shows friction, write the equivalent trait ourselves — the surface area is small enough that "build" is a credible competitor to "buy" here.
How can I help you explore Laravel packages today?