v4 is mostly additive. Breaking changes are limited to minimum versions and a small handful of API removals. Full details in UPGRADING.md.
Highlights
#[Sluggable]attribute as a drop-in alternative to theHasSlugtrait. Trait-based models keep working unchanged.- Self-healing URLs: route keys that combine the slug with the primary key (
hello-world-5) so renaming a model never breaks an existing link. Stale URLs return a308(was301) soPUT/PATCH/DELETEkeep working. - Overridable actions: swap the slug generator or self-healing URL builder/parser via
config/sluggable.php. - Laravel Boost skill bundled with the package for AI assistants.
Breaking changes
- Minimum PHP 8.3 and Laravel 12.
spatie/laravel-translatablev6+ when usingHasTranslatableSlug. Pest 4 / Testbench 10+ in your test suite. skipGenerateWhen()is now evaluated on every save instead of once. TheSlugOptions::\$skipGenerateboolean is gone in favor of\$skipGenerateWhen.- The closure-shaped options (
generateSlugsFrom,extraScope,usingSuffixGenerator,skipGenerateWhen) are typed asClosure. Array/string callables need wrapping in afn. HasSlugno longer keeps aprotected \$slugOptionscache; overridegenerateSlugAction()to inject custom behavior instead.- Self-healing redirects default to
308 Permanent Redirect. - The
Sluggablefacade was renamed toSelfHealing.
See UPGRADING.md for migration steps.