cubicmushroom/valueobjects
A small PHP package providing lightweight Value Object classes to model immutable domain values (e.g., IDs, money, email, dates) with validation and type-safety. Useful for cleaner Laravel apps and DDD-style codebases.
Money, Email, UserId), reducing bugs in financial systems, e-commerce, or identity management.DateRange, Percentage) from scratch, accelerating development for teams already using Laravel/PHP.Email objects reject invalid formats at creation).OrderTotal prevents negative values).ProductSku instead of raw strings).Adopt if:
Look elsewhere if:
spatie/array-to-object or custom solutions).For Executives:
"This package lets us treat critical data (like prices or user emails) as self-validating objects—catching errors early and reducing support costs. For example, an Email object will reject invalid formats at creation, saving QA time. It’s a lightweight way to adopt Domain-Driven Design without heavy refactoring, ideal for scaling our [product domain]."
For Engineering: *"We’re adding a zero-dependency way to enforce immutability and validation for core data types. Instead of:
$price = 9.99; // Could become -9.99 anywhere
We’d use:
$price = new Money(9.99, 'USD'); // Throws on invalid input
This aligns with our DDD goals and plays well with Laravel’s type-hinting. Tradeoff: Slightly more boilerplate upfront, but long-term safety gains—especially for financial or user-facing logic."*
How can I help you explore Laravel packages today?