Looking to hire Laravel developers? Try LaraJobs

laravel-taxonomy maintained by webwizardsusa

Description
Drupal-style taxonomy for Laravel: free-tagging and hierarchical category vocabularies defined in code, with optional Filament fields and management pages.
Author
Last update
2026/11/17 22:37 (dev-main)
License
Downloads
3

Comments
comments powered by Disqus

Laravel Taxonomy

Latest version on Packagist Tests Total downloads PHP version Laravel version License

Drupal-style taxonomy for Laravel. Records are tagged with Terms from Vocabularies. A Vocabulary is either open, for free tagging, where typing a new name creates the Term, or closed, for categories that administrators curate, and closed Vocabularies can be hierarchical. Vocabularies are classes in your code; only Terms live in the database. Filament is optional: with it you also get a tag input, a Term select, a table column, an infolist entry, a table filter and a management page for each Vocabulary.

Requires PHP 8.3+ and Laravel 12 or 13 (Filament 5 for the optional Filament pieces).

composer require webwizardsusa/laravel-taxonomy
php artisan vendor:publish --tag=taxonomy-config
php artisan vendor:publish --tag=taxonomy-migrations
php artisan migrate

Usage

use Webwizardsusa\Taxonomy\Vocabulary;

class TagsVocabulary extends Vocabulary
{
    public static function key(): string
    {
        return 'tags';
    }

    public function label(): string
    {
        return 'Tags';
    }

    public function isOpen(): bool
    {
        return true;
    }
}

List it in config/taxonomy.php ('vocabularies' => [TagsVocabulary::class]), add the HasTerms trait to a model, and tag and query Records:

$post->syncTerms('tags', ['PHP', 'Laravel']);

Post::withAnyTerms(['php'], 'tags')->get();

Documentation

Read the full documentation in the docs folder.

License

The MIT License (MIT). See LICENSE.md.