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+.
icon, color, or featured flags) without altering the core schema.featured can exist for both Category and Tag), enabling cleaner URL structures and avoiding global conflicts.taxonomy:install Artisan command streamlines setup.left/right values). Requires understanding of Materialized Path or Closure Table alternatives if needed.taxonomables table growth in large-scale apps.search() but may require Algoritma or Scout integration for advanced use cases.HasTaxonomy) and query builders.creating, updating, deleting hooks for taxonomies.TaxonomyTestCase).Product or Article).DB::enableQueryLog()).left, right, depth).// Seed nested-set values for existing categories
$categories = Category::all();
$tree = new \Aliziodev\LaravelTaxonomy\Services\TreeBuilder($categories);
$tree->build();
category()->whereParentId() for withTaxonomyHierarchy()).left/right columns are BIGINT to avoid overflow.Taxonomy for search-as-you-type functionality.php artisan taxonomy:install.config/taxonomy.php (e.g., disable autoload for multi-tenant).HasTaxonomy trait to models needing taxonomies.use Aliziodev\LaravelTaxonomy\Traits\HasTaxonomy;
class Product extends Model
{
use HasTaxonomy;
}
Electronics, Books) via a seeder or migration.withTaxonomySlug()).config/taxonomy.php:
'cache' => [
'enabled' => env('TAXONOMY_CACHE_ENABLED', true),
'prefix' => 'taxonomy_',
],
taxonomables table growth and query performance with Laravel Debugbar.UPGRADE.md).config/taxonomy.php.'model' in the config.Taxonomy::debug() to inspect tree structures.DB::enableQueryLog();
$tree = Taxonomy::tree(TaxonomyType::Category);
dd(DB::getQueryLog());
type, slug, and parent_id:
How can I help you explore Laravel packages today?