Weave 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

Eav Laravel Package

sunel/eav

Sunel/EAV brings flexible Entity-Attribute-Value modeling to Laravel. Attach dynamic attributes to Eloquent models without constant migrations, store typed values, and query entities by custom attributes—ideal for catalogs, CMS data, and configurable products.

View on GitHub
Deep Wiki
Context7

Entity–attribute–value model (EAV) for Laravel Artisan

Frequently asked questions about Eav
What Laravel versions does sunel/eav support?
The last release (September 2018) targets Laravel 5.5 through 5.7 with PHP 7.1 to 7.3. It predates Laravel 6's semver shift, the Symfony 4/5 upgrades, and PHP 7.4/8.x typing changes. Installing it in a Laravel 9, 10, or 11 app will almost certainly require a fork and patches before migrations even run.
How do I install sunel/eav in a Laravel project?
It is a standard Composer package: require it, publish the migrations and config, then migrate. The service provider registers eav:* Artisan commands that scaffold entity types, attributes, migrations, and seeders. On the supported Laravel 5.5-5.7 stack this is a low-friction install; on modern Laravel treat the source as something to adopt and maintain rather than a drop-in dependency.
What is the EAV pattern and when should I use it in Laravel?
Entity-Attribute-Value modeling stores entities in one table, attribute definitions in another, and typed values in a third, so fields can be added at runtime without schema changes. It fits cases where a meaningful share of the schema is unknown at build time, such as per-category catalog fields, CMS content types, per-tenant custom fields, or configurable forms. It is a poor fit when most fields are known upfront or when reporting, aggregation, and multi-attribute sorting dominate your queries.
Can sunel/eav attach dynamic attributes to existing Eloquent models?
Yes. The package ships an Eloquent trait that lets any model carry runtime-defined attributes backed by polymorphic entities, attributes, and values tables. Attribute definitions and their typed values are managed through the package rather than through new columns. You still design the entity types and attributes, usually with the Artisan generators.
How do I filter or sort entities by custom attributes with EAV?
Filtering or sorting on attributes requires joining the value table, often with self-joins per attribute, or post-query filtering in PHP. This is the intrinsic cost of EAV and the package does not remove it. Multi-attribute filtering is the performance cliff edge, so benchmark with realistic row counts before committing. JSON columns with generated-column indexing are often a simpler alternative for the same use case.
Is sunel/eav still maintained?
No. It is a single-maintainer package with roughly 153 stars and no release since September 2018, so there are no upstream security or compatibility patches. Your team effectively becomes the maintainer by default. Budget for owning a fork, including the tests, before adopting it.
What are the risks of using sunel/eav in production?
Three risks dominate: abandonment with no upstream fixes, framework drift that turns every Laravel major upgrade into a fork-and-patch exercise, and EAV-intrinsic issues like N+1 queries through accessors and no database-level type enforcement. Bad or mistyped values fail silently until they surface in a report. Plan an owner for the fork and a clear exit cost if maintenance stops.
Does sunel/eav enforce types on attribute values?
The value table has no database-level type enforcement, so incorrect data is stored silently rather than rejected. Typing is handled in application code through the package's typed value handling. Add your own validation and periodic data-integrity checks if value correctness matters.
What are the alternatives to sunel/eav for dynamic attributes in Laravel?
JSON columns with casts plus jsonb or generated-column indexing cover much of the same ground with better tooling in modern Laravel. Conventional nullable columns or a small custom attribute table are simpler when attributes only change at deploy time. Choose EAV only when attributes genuinely change at runtime through an admin UI or per-tenant configuration.
How many entity types, attributes, and value rows can sunel/eav handle?
There is no hard package limit, but the value table grows in rows rather than columns, so read performance degrades as attribute-filtering queries multiply. Estimate row counts at 12 and 36 months and load-test multi-attribute filtering before committing. Attribute-heavy writes are generally fine; attribute-heavy multi-filter reads are where EAV hurts.
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.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections