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

Text Value Objects Laravel Package

apie/text-value-objects

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Domain-Driven Design (DDD) Alignment: Enables strict typing and validation for text-based domain entities (e.g., Email, Name, Slug, Description), reducing ambiguity in business logic and improving code maintainability.
  • API/Backend Consistency: Standardizes text handling across microservices or monolithic applications, ensuring uniform validation rules (e.g., max length, regex patterns) for fields like usernames, product descriptions, or metadata.
  • Build vs. Buy: Justifies building reusable value objects instead of buying a full DDD framework (e.g., Spatie’s Laravel packages) if the team already uses Apie or needs lightweight, composable components.
  • Roadmap for Data Integrity: Prioritizes features like:
    • Input Sanitization: Auto-escaping or stripping HTML/tags from user-generated text (e.g., for CMS content).
    • Localization Support: Extending value objects to handle multilingual text (e.g., LocalizedTitle).
    • Audit Trails: Logging changes to critical text fields (e.g., LegalDisclaimer) via Laravel events.
  • Use Cases:
    • E-commerce: Validating ProductTitle (length, special chars) or SKU (regex format).
    • SaaS: Enforcing Username rules (alphanumeric + underscores) or APIKey masking.
    • Publishing: Sanitizing ArticleContent to prevent XSS.

When to Consider This Package

  • Look Here If:

    • Your team uses Apie or plans to adopt it for API development (this package is tightly coupled).
    • You need lightweight, composable value objects without the overhead of full DDD frameworks (e.g., avoid Spatie’s laravel-data if you only need text validation).
    • Text fields in your domain require consistent validation across multiple services (e.g., shared UserProfile logic).
    • You’re building a Laravel-based system where text integrity is critical (e.g., financial reports, medical records).
  • Look Elsewhere If:

    • You need GUI tools for defining value objects (consider Laravel Nova or Filament).
    • Your use case requires complex nested validation (e.g., JSON schemas; use JSON Schema Validator).
    • You’re not using PHP/Laravel (this package is PHP-specific).
    • You need pre-built UI components for value objects (e.g., form inputs; this is backend-only).
    • The package’s lack of documentation is a blocker (consider alternatives like Ash Alliance for DDD in Laravel).

How to Pitch It (Stakeholders)

For Executives:

"This package lets us enforce strict rules for text data (e.g., usernames, product descriptions) across our systems, reducing errors and improving compliance. For example, we can automatically reject invalid SKUs or sanitize user-generated content to prevent security risks. It’s a lightweight, reusable solution that aligns with our Laravel stack—no need for heavy frameworks. Early adoption could cut support costs for data integrity issues by 30%."

For Engineering:

*"Problem: Text fields in our domain (e.g., Article.title, User.email) often have inconsistent validation, leading to bugs and security gaps. Solution: This package provides immutable, validated text value objects (e.g., Email, Slug) that:

  • Enforce rules at the domain layer (e.g., maxLength=255, regex=/^[a-z0-9_-]+$/i).
  • Integrate seamlessly with Apie (if we’re using it) or Laravel’s request validation.
  • Are composable: Extend or combine objects (e.g., HashedPassword + Email). Trade-offs:
  • No docs yet (we’d need to write tests/examples).
  • Tied to Apie (but we can use it standalone for validation). Ask: Approval to prototype this for UserProfile and Product text fields in Q3."*

For Developers:

*"Why This? Instead of writing repetitive validation logic like:

if (!preg_match('/^[a-z0-9_-]+$/', $username)) { throw new \InvalidArgumentException(); }

We’d use:

$username = new Username($rawInput); // Auto-validates and throws on failure.

How to Start:

  1. Add to composer.json: apie/text-value-objects.
  2. Create a ValueObject trait or base class to standardize our domain objects.
  3. Test with critical fields (e.g., Email, APIKey). Blockers: Need to define our own validation rules since docs are sparse."*
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.
datacore/hub-sdk
alengo/sulu-http-cache-bundle
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
imbo/imbo-coding-standard
visualbuilder/filament-lottie
servicioslineaonce/starter-kit
atomcoder/laravel-reorderable
irajul/filament-shadcn-theme
agtp/agtp-php
agtp/mod-php
centraldesktop/protobuf-php
trappistes/laravel-custom-fields
splash/sonata-admin
splash/metadata