Download the PHP package aliziodev/laravel-terms without Composer
On this page you can find all versions of the php package aliziodev/laravel-terms. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-terms
Laravel Terms
Lightweight, flat taxonomy package for Laravel. Attach reusable terms — tags, categories, brands, colors, sizes, or any custom type — to any Eloquent model via a polymorphic pivot, without nested-set complexity.
Features
- Flat term model — no nested sets, no adjacency lists; one simple
termstable - Polymorphic pivot — attach terms to any model with a single trait
- Type-based scoping — built-in enum types (
tag,category,brand,color,size) plus arbitrary string types - Context on pivot — group term attachments by an optional context string (e.g.
primary,sidebar), with context-aware sync and detach - Configurable morph key —
numeric(default),uuid, orulid - Auto slug generation — slugs derived from names, unique per type
hasTerm()— fast boolean existence check without loading the relationwhereHasTerms()— scope for AND / OR multi-term filteringTerm::ordered()— scope to order terms byorder- Minimal surface area — manager, trait, one model, one migration
Requirements
| Laravel | PHP |
|---|---|
| 11.x | 8.2+ |
| 12.x | 8.2+ |
| 13.x | 8.3+ |
Installation
Run the installer (publishes config + migration, optionally migrates):
Or publish manually:
Configuration
config/terms.php — published to your app:
Usage
1. Add the trait to your model
If your model uses UUID or ULID primary keys, set morph_type in config/terms.php to match.
2. Attach, sync, and detach terms
Custom string types work without any configuration:
3. Query
4. Context
Attach the same term under different contexts (e.g. display slots):
5. Facade
6. Term model scopes
Extending the Term model
Publish the config and swap model:
Differences from laravel-taxonomy
| Feature | laravel-terms | laravel-taxonomy |
|---|---|---|
| Hierarchy | None (flat) | Nested set / adjacency list |
| Term ordering | order column |
Full tree ordering |
| Pivot context | Yes | Varies |
| Migration complexity | 2 tables | 2 tables |
| Footprint | Minimal | Feature-rich |
Use laravel-terms when you need simple, flat labels. Use laravel-taxonomy when you need parent–child term trees.
Testing
License
MIT — see LICENSE.
All versions of laravel-terms with dependencies
illuminate/contracts Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0