aliziodev/laravel-taxonomy
Flexible Laravel package for managing taxonomies, categories, tags, and hierarchical trees. Includes nested-set support for fast hierarchy queries, metadata, bulk operations, caching, and custom taxonomy types. Compatible with Laravel 11+.
/api/categories?include=children).| Use Case | Why This Package? |
|---|---|
| E-commerce Categories | Pre-built nested-set queries for category trees; bulk attach/detach for products. |
| Blog Tagging | Polymorphic relationships to attach tags to posts; type-specific filtering. |
| SaaS Product Attributes | Custom taxonomy types (e.g., "Brand," "Material") with metadata for dynamic filters. |
| Dynamic Navigation | Generate breadcrumbs or menus from hierarchical taxonomies via tree() methods. |
| Multi-Language Support | Extendable to store translated names/slugs via metadata (e.g., meta['translations']). |
| Analytics Segmentation | Filter models by taxonomy type (e.g., "Users tagged with 'premium'") for reporting. |
left join tree traversals).spatie/laravel-permission or implement custom policies."Laravel Taxonomy is a plug-and-play solution to organize and scale hierarchical data—like categories, tags, or attributes—without custom development. For example:
ROI: Cuts development time by 60% for hierarchical systems, with zero ongoing maintenance. Used by [X] teams at [Company] for [specific use case]."
"This package solves three key problems in Laravel apps:
getDescendants()). No more recursive Eloquent queries.Product, Article) with a single trait (HasTaxonomy).syncTaxonomies()), type safety, and caching. Example:
// Attach categories to a product
$product->syncTaxonomiesOfType(TaxonomyType::Category, [$electronics, $smartphones]);
// Query products in a category (with descendants)
$products = Product::withTaxonomyHierarchy($electronics->id)->get();
Trade-offs:
Recommendation: Use for any project with hierarchical data. Skip if you need graph traversals or real-time edits."**
How can I help you explore Laravel packages today?