boson-php/value-object-contracts
User, Order, Payment) via value objects (immutable, self-validating objects like Email, Money, DateRange). Aligns with DDD’s focus on modeling core domain logic.Email must be RFC-compliant). Supports backward-compatible schema changes without breaking clients.EmailValidator classes) or relying on third-party libraries like Symfony Validator for domain-specific rules. Lightweight alternative to Laravel Nova or Filament for internal tooling.ProductPrice, InventoryQuantity, or ShippingAddress as value objects.Currency + Amount rules (e.g., no negative values, valid ISO codes).SubscriptionPlan, ApiKey) across microservices.Validator facade) for simple forms—this package is not a replacement for request validation.ActiveModel::Validations).Email must always validate before use").Money objects in CLI tools, queues, or APIs).array_key_first, str_contains)."This package lets us write once, validate everywhere—think of it like ‘TypeScript for PHP business logic.’ For example, instead of trusting a frontend form to send a valid email, we enforce Email::fromString() at the code level. This reduces bugs in critical flows (e.g., payments, user onboarding) and makes our APIs more predictable for partners. The MIT license means no vendor lock-in, and the lightweight design avoids adding bloat to our stack."
ROI:
*"This is a minimalist DDD toolkit for PHP/Laravel. Key benefits:
Order → Money → Currency).Example Use Case:
// Instead of:
$email = $_POST['email']; // Risky!
// Do:
$email = Email::fromString($_POST['email']); // Throws \InvalidArgumentException if invalid.
Trade-offs:
string with Email everywhere).Next Steps:
PaymentAmount).CONTRIBUTING.md section for new devs.Slug, Hashtag)."*How can I help you explore Laravel packages today?