EAV
Description
EAV adds entity-attribute-value support to Enso.
The package manages ordered attribute groups, ordered attributes inside groups, enumerated attribute values, and the services needed to build grouped EAV payloads for consumers. It is designed for domains where the attribute surface must remain configurable without introducing schema changes for every new field.
This is the backend/API package. It handles persistence, ordering, and validation of configurable attributes and their values.
Installation
This is a proprietary package distributed through the private Enso registry.
Run the package migrations:
php artisan migrate
Optional publishes:
php artisan vendor:publish --tag=eav-factory
php artisan vendor:publish --tag=eav-seeder
Features
- Hierarchical attribute groups with ordering support.
- Ordered attributes inside groups, including move operations across groups.
- Attribute value lists for collection-like attributes.
- CRUD and move endpoints for groups, attributes, and values.
Eavservice for producing grouped attribute payloads, with optional filtering to only attributes that have values.AttributeValuevalidator for integer, decimal, boolean, string, and collection attribute types.
Usage
Useful model helpers:
Group::tree()Group::move(int $orderIndex, ?int $parentId)Attribute::move(int $orderIndex, int $groupId)Attribute::searchableKey()
Build a grouped EAV payload:
use LaravelEnso\Eav\Services\Eav;
$data = (new Eav($attributes, $values))->data(filtered: true);
Validate an incoming raw attribute value:
use LaravelEnso\Eav\Services\AttributeValue;
AttributeValue::validates($attribute, $value);
API
HTTP routes
Groups:
GET api/eav/groupsPOST api/eav/groupsPATCH api/eav/groups/{group}DELETE api/eav/groups/{group}PATCH api/eav/groups/{group}/moveGET api/eav/groups/options
Attributes:
GET api/eav/attributes/{group}/createPOST api/eav/attributesGET api/eav/attributes/{attribute}/editPATCH api/eav/attributes/{attribute}DELETE api/eav/attributes/{attribute}PATCH api/eav/attributes/{attribute}/move
Values:
POST api/eav/values/storePATCH api/eav/values/{value}DELETE api/eav/values/{value}GET api/eav/values/options
Depends On
Required Enso packages:
Runtime companion packages:
Companion frontend package: