Installation and Setup

You can install the package via composer:

composer require spatie/laravel-tags

Next up, the service provider must be registered:

// config/app.php
'providers' => [


You can publish the migration with:

php artisan vendor:publish --provider="Spatie\Tags\TagsServiceProvider" --tag="migrations"

After the migration has been published you can create the tags and taggables tables by running the migrations:

php artisan migrate

You can optionally publish the config file with:

php artisan vendor:publish --provider="Spatie\Tags\TagsServiceProvider" --tag="config"

This is the contents of the published config file:

return [

     * The given function generates a URL friendly "slug" from the tag name property before saving it.
    'slugger' => 'str_slug',