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

Value Object Laravel Package

micro-module/value-object

Immutable, self-validating value objects for PHP and Laravel. Wrap primitives like emails, IDs, and money in typed classes that guard their own invariants, so invalid values can't exist and domain logic stays clean, testable, and free of scattered validation checks.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy for domain primitives: Value objects (Money, Email, PhoneNumber, DateRange, Percentage) are the kind of foundational types every domain model eventually needs. This package supports an explicit decision: adopt a pre-built collection versus writing 5–10 small immutable classes in-house. For most teams the honest answer is "build," but this package is a useful reference point for what the in-house API surface should look like.
  • Reducing primitive obsession in domain code: If the roadmap includes features where correctness matters — pricing, billing, currency handling, identity/email validation, scheduling — value objects are the mechanism that makes invalid states unrepresentable. This package supports sequencing that refactor earlier rather than later, before primitive-shaped data leaks into APIs and database schemas.
  • Scoping a "domain hygiene" epic: Adopting value objects is rarely a standalone feature; it's an enabling refactor. Use this package assessment to decide whether the epic is "introduce a shared ValueObject namespace" (build) or "evaluate a library" (buy) — and to timebox the spend accordingly.
  • API and contract design: Immutable value objects make DTOs, request payloads, and event contracts more predictable. Relevant when designing public APIs or cross-service contracts where implicit string/int conventions become a compatibility liability.
  • Roadmap de-risking for multi-tenant or financial features: Anything involving money, tax, or per-tenant configuration benefits disproportionately from typed, validated, immutable values. This package is a low-cost way to prototype that modeling before committing.
  • Dependency policy decisions: With 1 star, 0 dependents, and a single maintainer, evaluating this package is really a decision about your organization's tolerance for low-adoption dependencies — which is itself a useful policy conversation to have explicitly.

When to Consider This Package

Consider it when:

  • You are prototyping or writing an internal tool where the cost of a dependency going unmaintained is low and the convenience of not hand-rolling classes is real.
  • Your team is new to value objects and you want a concrete, readable reference implementation to align on conventions (immutability, equals(), named constructors, validation-on-construction) before writing your own.
  • You need a small, framework-agnostic set of primitives and are prepared to vendor/fork it — the code is almost certainly small enough to audit in an hour and copy into your own codebase.
  • You are explicitly evaluating "micro-module" style packages and want a comparison point.

Look elsewhere (or build in-house) when:

  • The code will sit on a critical path — payments, auth, or anything where a silent behavior change is expensive. One star and zero dependents means no community pressure-testing of edge cases.
  • You need long-term support guarantees, security responsiveness, or a documented deprecation policy. There is no evidence of a maintainer team, changelog discipline, or issue-response track record in the signals available.
  • Your framework already provides equivalent primitives, or your team can write the 200–400 lines involved. Value objects are one of the few categories where in-house is usually the correct call: they encode your domain rules, and third-party validation semantics often conflict with them.
  • You need deep integration — Laravel casts, Eloquent embedding, validation rule bridging, serialization. A generic PHP collection will not carry that weight, and you'll end up writing the adapters anyway.
  • Package hygiene requirements are strict (composer audit, license review, SBOM). A near-zero-adoption dependency adds supply-chain surface for marginal benefit.

Bottom line for a PM: treat this as an evaluation artifact, not a production dependency. The decision it should drive is "do we standardize value objects in our domain layer, and what is our in-house API?" — not "do we install this."

How to Pitch It (Stakeholders)

For executives (30 seconds): We're evaluating a small open-source PHP library that provides immutable "value object" types — think Money, Email, DateRange. The concept is valuable: it makes invalid data structurally impossible instead of relying on validation scattered across the codebase, which reduces a class of production bugs and speeds up onboarding. However, this specific package has essentially no adoption (1 star, zero dependent projects, single maintainer), so the recommendation is to adopt the pattern, not the package — a small in-house implementation gives us the same correctness benefits with no dependency risk. Effort is measured in days, not weeks; the payoff is fewer data-integrity defects in billing and account flows.

For engineering: The package is a thin collection of immutable classes — likely named constructors, equals(), and validation-at-construction. It's a reasonable pattern reference but not something to depend on: no adoption, no visible governance, and value objects are inherently domain-specific, so third-party validation rules will fight ours. Proposal: review it as a design reference, then implement a Domain\ValueObjects namespace with our own conventions (immutability, fromString/fromInt constructors, exceptions over booleans, Laravel cast adapters where needed). Roll out incrementally — start with Money and Email in the billing and accounts contexts, measure defect rates and PR review friction, then expand. Keep the door open to a third-party library only if we later need broad currency/locale coverage that's expensive to maintain ourselves.

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.
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels
wazza/laravel-db-encryption
hokny/laravel-generator
vonsogt/backup
jengo/queues
jeremykenedy/laravel-observability
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums