michael-rubel/laravel-value-objects
Laravel Value Objects offers an abstract base class and Eloquent casts for turning model attributes into immutable value objects, with validation, comparison helpers, and PHP 8 support for cleaner, type-safe domain code.
Release assessed: 7.0.2 — patch-level; two PRs (PHP 8.4 CI coverage; negative-number fix in the Number value object), one first-time contributor. No breaking changes, no new features, no deprecations. Net effect on the prior assessment: one named risk is reduced (runtime/version matrix), one caution is added (arithmetic semantics in Number were wrong and untested until now), and the recommendation is unchanged.
Architecture fit
spatie/laravel-data, or enum-based domain modelling; treat it as a normalization + validation primitive, not a domain layer.Integration feasibility
composer require with package auto-discovery; no infrastructure, no migrations, no config publishing required for baseline use. Estimated spike effort: 1–2 engineer-days for a POC, 1 sprint for a bounded production slice.^7.0.2 in the spike and expect no migration work. The negative-number fix is a behavior change only for callers that were relying on incorrect arithmetic in Number — we have no such callers today, so this is a clean adoption point.Technical risk
JsonSerializable behavior is a common source of subtle breakage.composer.json constraints, which this release does not demonstrate.Number (new): a sign-handling bug in a scalar wrapper is the kind of defect that surfaces as an off-by-a-minus in an invoice, refund, or ledger delta. That it shipped in 7.0.1 and needed a community fix tells us the test suite did not cover signed inputs. Treat any arithmetic-bearing value object as unverified and assert our own expectations rather than trusting upstream green builds.Key questions
Number should be excluded unless a concrete use case requires it.null, empty string, and dirty legacy data gracefully, or does it throw on read?composer.json constraints? PHP 8.4 is now CI-verified; is Laravel 11/12 in the constraint set, and is there a documented semver/BC policy?Number is in scope, are signed values, zero, and precision/rounding covered by our own tests?Stack fit
spatie/laravel-data-style DTOs if we keep value objects at the leaf positions.Migration path
App\Support\ValueObjects) that wraps or extends the package classes. This gives us a one-file swap if the package is abandoned, and a place to centralize our normalization rules.*_normalized or documented canonical form before changing existing columns.Compatibility
composer.json.Sequencing
^7.0.2 in a sandbox branch, exercise each candidate value object, record failure modes and serialization behavior. Include signed/zero inputs if Number survives scoping.Maintenance
composer outdated review rather than continuous tracking.Support
Number fix reinforces this: upstream green is not our green.Scaling
Failure modes
VARCHAR lengths (phone numbers gaining country codes is the classic case).Ramp-up
TPM recommendation: proceed to a timeboxed spike and a single-context pilot on 7.0.2; do not adopt as a cross-cutting standard until the exception-mapping, legacy-data audit, and upgrade-constraint questions are answered. 7.0.2 improves the dependency's risk profile slightly — PHP 8.4 is now CI-verified and an external contribution was triaged and merged — but it does not answer the Laravel-version, BC-policy, or legacy-data questions, and the Number defect is a reminder that correctness in edge cases lives with us. Exclude Number from the initial scope. The package's low coupling makes a reject-or-reverse decision cheap, which remains the main reason the risk is acceptable at all.
How can I help you explore Laravel packages today?