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

Php Value Objects Laravel Package

bruli/php-value-objects

A lightweight PHP library for building immutable value objects with typed primitive wrappers and validation. bruli/php-value-objects helps enforce domain invariants, reduce primitive obsession, and keep Laravel or any PHP codebase clearer and safer.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Domain integrity as a product quality lever. Value objects (emails, names, IDs, money, dates) move validation and business rules out of controllers/forms and into typed, self-validating primitives. That directly reduces the class of defects PMs care about: malformed emails in the CRM, negative quantities in carts, currency mismatches in checkout, duplicate/invalid identifiers.
  • Build vs. buy for foundational primitives. Rather than every squad hand-rolling Email, Money, and Uuid wrappers (with divergent validation rules), this package is a candidate shared vocabulary. The decision is "adopt a small MIT library" vs. "standardize an internal package" vs. "leave to each team."
  • Roadmap input for DDD / modular monolith investments. If the roadmap includes bounded contexts, event-driven modules, or a domain layer that survives framework upgrades, value objects are the cheapest first step. This package is a low-commitment way to pilot that direction.
  • Feature scoping and acceptance criteria. When speccing registration, checkout, KYC, tenancy, or billing, PMs can write acceptance criteria in terms of domain types ("amount is a non-negative Money in a supported currency") instead of field-level rules — which makes QA and cross-team contracts clearer.
  • Use cases where it pays off fastest: identity and access (typed user/tenant IDs), payments and pricing (Money/Currency), onboarding and profile (Email/Name/Phone), scheduling and reporting windows (typed date ranges), and any integration boundary where untrusted input becomes domain state.
  • Portability and vendor-risk decisions. Because it is framework-agnostic, it can be evaluated independently of Laravel version upgrades — a plus for architecture decisions, but it also means Laravel-specific conveniences (validation rules, casts, service providers) are a gap the team must fill.

When to Consider This Package

Consider it when:

  • Your team already practices (or is deliberately piloting) DDD tactical patterns and wants a small, MIT-licensed starting point for common primitives.
  • The need is narrow and well-understood — a handful of standard value objects — and the team is willing to vendor, fork, or wrap the code rather than depend on upstream releases.
  • You want to standardize validation semantics across services without building an internal package from scratch.
  • You are in a PHP-only or Laravel-plus-other-PHP-services environment where a framework-neutral library is preferable to a Laravel-coupled one.
  • You need a teaching/reference implementation to align engineers on what a value object should look like before designing your own.

Look elsewhere when:

  • Maintenance signal is weak. At ~43 stars with an unspecified repository and no visible release cadence, treat this as reference code, not a critical-path dependency. If you need SLAs, security response, or PHP-version support guarantees, prefer actively maintained alternatives or an internal package.
  • You need richer, battle-tested domains. For identifiers, look at ramsey/uuid or symfony/uid; for money, moneyphp/money or brick/money; for broader typed collections and primitives, spatie/laravel-data (with Laravel casting support) or Doctrine embeddables.
  • You want first-class Laravel ergonomics. This package does not appear to ship Eloquent casts, validation rules, service providers, or config. If you need Castable attributes and FormRequest integration out of the box, you will be writing glue code.
  • The team is not DDD-fluent. Value objects without domain discipline become ceremony. If the org is form-request-plus-Eloquent, the adoption cost likely exceeds the benefit.
  • PHP version or typing requirements exceed what the library pins to. Verify supported PHP versions against your platform matrix before committing.

How to Pitch It (Stakeholders)

For executives (one paragraph): We are evaluating a small, MIT-licensed PHP library that packages common "value objects" — validated, immutable building blocks for things like emails, identifiers, and monetary amounts. The business case is defect prevention and delivery speed on domain-heavy features (onboarding, billing, tenancy): validation rules live in one typed place instead of being re-implemented per screen, which reduces data-quality bugs and duplicated logic. Cost is effectively zero in licensing and low in integration, but the library has a small community footprint, so the recommendation is to treat it as a reference implementation we vendor or fork, not a strategic dependency. This is an engineering-led decision with a modest, measurable quality payoff — not a platform bet.

For engineering leads:

  • The pitch is invariants at the boundary: construct-validated, immutable objects carried through the domain, converted to primitives only at persistence and transport edges.
  • Upside: tiny surface area, framework-agnostic, trivially testable, no runtime magic. Easy to read in a code review.
  • Risks to name honestly: low star count and unclear repo provenance mean no meaningful upstream support; you will own the code. Plan to fork into an internal namespace, pin it, and add your own Laravel glue (Eloquent casts, validation rules, factories) rather than wait for features.
  • Recommended path: two-week spike on one bounded context (e.g., payments or onboarding), measure reduction in duplicated validation and defect escapes, then decide between forking this library and assembling a thin internal package over ramsey/uuid and moneyphp/money.
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.
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource