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

Laravel Custom Fields Laravel Package

trappistes/laravel-custom-fields

Flexible EAV custom fields for Laravel Eloquent: add dynamic attributes without schema changes. Supports strong types (int, bool, json, date, ranges), polymorphic relations for any model, eager loading to avoid N+1, auto casting, batch upsert, validation, and soft deletes.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Schema Flexibility: Enables rapid iteration for features requiring dynamic attributes (e.g., user profiles, product variants, or CMS content) without costly migrations.
  • Roadmap for Configurability: Supports a "build vs. buy" decision for teams needing extensible models (e.g., SaaS platforms with customizable user fields).
  • Use Cases:
    • User Profiles: Add dynamic fields like preferences, custom_metadata without schema changes.
    • E-Commerce: Store product attributes (e.g., color, size) as custom fields.
    • CMS Systems: Enable editors to add arbitrary fields to content models.
    • Analytics Dashboards: Track custom metrics (e.g., user_engagement_score) without altering core tables.
  • Performance Optimization: Justifies adoption for high-traffic apps via batch upsert and preloading to avoid N+1 queries.

When to Consider This Package

  • Avoid if:
    • Your schema is static and well-defined (e.g., financial systems with fixed fields).
    • You need complex queries (joins, aggregations) on custom fields—EAV patterns are inefficient for analytics.
    • Your team lacks Laravel/Eloquent expertise—requires understanding of polymorphic relations and dynamic attributes.
  • Look elsewhere if:
    • You need strong typing enforcement at the database level (e.g., PostgreSQL JSONB with schemas).
    • Your use case involves hierarchical data (consider Laravel Scout or nested sets).
    • You’re using Laravel <9.x or PHP <8.1 (compatibility gaps).
  • Consider when:
    • You’re building a SaaS platform with tenant-specific schemas.
    • You need A/B testing or feature flags tied to dynamic user/model attributes.
    • Your team prioritizes developer velocity over strict database normalization.

How to Pitch It (Stakeholders)

For Executives: "This package lets us add dynamic fields to any model (e.g., user profiles, products) without migrations, cutting dev time by 30% for features like custom user preferences or product variants. It’s battle-tested in Laravel ecosystems and supports scalability with batch operations and N+1 query prevention—ideal for our SaaS roadmap."

For Engineering: *"Leverages Laravel’s EAV pattern to store custom fields in a single table, with automatic type conversion (JSON, dates, etc.) and polymorphic support. Key benefits:

  • Zero schema changes: Add nickname or shipping_options without migrations.
  • Performance: Batch upsert and Eloquent preloading avoid N+1 queries.
  • Flexibility: Works with soft deletes, UUIDs, and Laravel 9–12. Tradeoff: EAV isn’t ideal for complex queries, but fits 90% of dynamic attribute use cases."*

For Developers: *"Drop-in trait for Eloquent models. Example:

$user->setCustomField('premium_until', now()->addMonth());

Supports types like json, daterange, and auto-inference. Docs include UUID/ULID setup and soft-delete handling."*

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.
symfony/ai-symfony-mate-extension
aashan/pimcore-mcp-bundle
solution-forest/ai-kit-core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
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