spatie/laravel-sluggable
Generate unique slugs for Eloquent models on create/update. Supports collision suffixes, translatable slugs, and customizable slug options. Includes self-healing URLs that keep old links working via slug+ID route keys with 308 redirects to the canonical URL.
Install the package via composer:
composer require spatie/laravel-sluggable
The service provider is registered automatically via Laravel package discovery.
The package ships with a config file that lists overridable actions. Publishing it is only required if you want to swap one of the default actions for your own class.
php artisan vendor:publish --tag=sluggable-config
The published file will look like this:
return [
'actions' => [
'generate_slug' => Spatie\Sluggable\Actions\GenerateSlugAction::class,
'build_self_healing_route_key' => Spatie\Sluggable\Actions\BuildSelfHealingRouteKeyAction::class,
'extract_identifier_from_self_healing_route_key' => Spatie\Sluggable\Actions\ExtractIdentifierFromSelfHealingRouteKeyAction::class,
],
];
See Overriding actions for details.
How can I help you explore Laravel packages today?