Weave Code
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

Valueobjects Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Domain-Driven Design (DDD) Alignment: Enables strict typing and immutability for business-critical data (e.g., Money, Email, UserId), reducing bugs in financial systems, e-commerce, or identity management.
  • Build vs. Buy: Avoids reinventing immutable value objects (e.g., DateRange, Percentage) from scratch, accelerating development for teams already using Laravel/PHP.
  • Roadmap Prioritization: Justifies investing in DDD patterns by providing a lightweight, battle-tested foundation for complex domains (e.g., subscription tiers, inventory quantities).
  • Use Cases:
    • Validating user inputs (e.g., Email objects reject invalid formats at creation).
    • Enforcing business rules (e.g., OrderTotal prevents negative values).
    • Simplifying API contracts (e.g., returning ProductSku instead of raw strings).

When to Consider This Package

  • Adopt if:

    • Your team prioritizes type safety and self-documenting code over raw performance.
    • You’re building domain-rich applications (e.g., SaaS, fintech) where data integrity is critical.
    • You need immutability to prevent side effects in stateful operations (e.g., order processing).
    • Your stack already uses Laravel/PHP and you want to avoid JavaScript/TypeScript alternatives.
  • Look elsewhere if:

    • Your project is prototype/simple CRUD with no complex business logic.
    • You require high-performance serialization (e.g., for microservices; consider spatie/array-to-object or custom solutions).
    • Your team lacks DDD experience—this package assumes familiarity with value objects.
    • You need active maintenance (fork the original or contribute; current stars/score are red flags).

How to Pitch It (Stakeholders)

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."*

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.
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony
spatie/flare-daemon-runtime