ekyna/characteristics
Laravel package for managing entity characteristics: define reusable attributes, groups and values, attach them to models, and handle normalization/validation for consistent storage and querying across your application.
config/app.php or a dedicated service provider. Check for Laravel-specific bootstrapping (e.g., register()/boot() methods).Builder or uses raw queries, ensure it doesn’t conflict with existing scopes/factories.characteristic_id, entity_type, key, value) or is flexible.{"color": "red", "size": "M"}) or user permissions.composer.json for require/conflict clauses and test on a staging environment.CharacteristicUpdater).with() in Laravel).characteristics table with additional columns like created_at) or enforce a rigid structure?retrieved)?spatie/laravel-activitylog for auditing?composer.json for compatibility).Cache::remember) to reduce database load.Characteristic::where('entity_id', 1)->get()).use Ekyna\Characteristics\Traits\HasCharacteristics).if ($product->color == 'red')) with dynamic queries.// Before
if ($product->color === 'red') { ... }
// After
$characteristics = $product->characteristics;
if ($characteristics->get('color') === 'red') { ... }
^9.0 vs. ^8.0). Use composer why-not ekyna/characteristics to check constraints.illuminate/support version conflicts).composer validate --strict post-installation.HasSoftDeletes to the base model.Characteristic::macro('scopedByType', fn($type) => ...)).composer.json and publish configurations (if any).class ProductCharacteristicRepository {
public function getForProduct(Product $product) {
return $product->characteristics()->get();
}
}
CharacteristicService).class CharacteristicPolicy {
public function update(User $user, Characteristic $characteristic) {
return $user->can('edit-characteristics');
}
}
characteristics table on entity_type, entity_id, and key.Cache::remember(
"characteristics:{$entityId}",
now()->addHours(1),
fn() => $entity->characteristics
);
composer outdated.entity_id uniqueness").DB_LOG_QUERIES=true
dd() or Xdebug to inspect characteristic hydration.try {
return $characteristics;
} catch (QueryException $e) {
return Cache::get("characteristics:fallback:{$entityId}", []);
}
How can I help you explore Laravel packages today?