Search by

webwizardsusa / laravel-taxonomy

webwizardsusa

Drupal-style taxonomy for Laravel: free-tagging and hierarchical category vocabularies defined in code, with optional Filament fields and management pages.

Package info

github.com/webwizardsusa/laravel-taxonomy

pkg:composer/webwizardsusa/laravel-taxonomy

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-11-17 19:47 UTC

This package is auto-updated.

Last update: 2026-11-17 21:37:20 UTC


README

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.