explaingit

spatie/laravel-sluggable

Analysis updated 2026-08-08 · repo last pushed 2026-07-28

1,555PHPAudience · developerComplexity · 2/5ActiveLicenseSetup · easy

TLDR

A Laravel package that automatically creates clean, readable URL segments (slugs) from your content titles, with support for unique slugs, self-healing redirects, and multi-language sites.

Mindmap

mindmap
  root((laravel-sluggable))
  What it does
    Auto-generates URL slugs
    Unique slug handling
    Self-healing URLs
  Tech stack
    PHP
    Laravel framework
  Use cases
    Blogs and articles
    E-commerce product pages
    Documentation sites
  Key features
    Translatable multi-language slugs
    Custom slug logic
    AI scaffolding assistant

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a blog where every post automatically gets a clean URL from its title.

USE CASE 2

Create an e-commerce store with descriptive product page URLs instead of ID numbers.

USE CASE 3

Set up a documentation site with readable URLs for each article and category.

USE CASE 4

Build a multi-language site with translatable slugs for each language.

What is it built with?

PHPLaravel

How does it compare?

spatie/laravel-sluggablespatie/laravel-honeypotdreeveapp/dreeve
Stars1,5551,5651,883
LanguagePHPPHPPHP
Last pushed2026-07-282026-06-02
MaintenanceActiveMaintained
Setup difficultyeasyeasymoderate
Complexity2/51/53/5
Audiencedeveloperdevelopergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Just install the Composer package and add a trait plus a few properties to your Eloquent model, no external infrastructure needed.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

If you've ever noticed how a blog post titled "My Summer Vacation" gets a URL like my-summer-vacation instead of a random ID number, you've seen slugs in action. Spatie's laravel-sluggable package does exactly this for Laravel applications, it automatically creates those clean, readable URL segments whenever you save a new piece of content. Instead of manually figuring out what the web address should be, you just give your content a title and the package handles the rest. The setup is straightforward: you add a small marker to your data model telling the package which field to pull from (like a title) and where to store the result (like a slug field). From that point on, every time you create or update a record, the package converts your title into a URL-friendly format, lowercase, spaces become dashes, special characters stripped out. If two pieces of content end up with the same slug, it automatically appends a number to keep them unique. One particularly thoughtful feature is what they call "self-healing URLs." When you enable it, your URLs combine the slug with a unique ID number. So if you rename a post from "Old Title" to "New Title," the old URL doesn't break, it automatically redirects visitors to the new address. This matters because broken links are bad for both user experience and search engine rankings. This package is built for developers working with Laravel, a popular PHP framework. A concrete example: imagine you're building a blog, an e-commerce store, or a documentation site. You want product pages, article pages, and category pages to all have memorable, descriptive URLs rather than strings of numbers. This package handles that automatically without any manual upkeep. The project also supports translatable slugs for multi-language sites, lets you swap in your own custom logic if the defaults don't fit, and includes an AI assistant integration for scaffolding sluggable models. It's an opinionated package, meaning the maintainers have made sensible default choices so you can get started quickly, but they've left the door open for customization when you need it.

Copy-paste prompts

Prompt 1
I have a Laravel model called Post with fields title and slug. Show me how to use spatie/laravel-sluggable so the slug is automatically generated from the title when I save a post.
Prompt 2
I want self-healing URLs so that if I rename a post the old URL redirects to the new one. How do I configure that with spatie/laravel-sluggable, and what does the URL format look like?
Prompt 3
My Laravel app needs translatable slugs for a multi-language blog. How do I set up spatie/laravel-sluggable so each language gets its own slug field?
Prompt 4
I have two posts with the same title and I'm worried about duplicate slugs. How does spatie/laravel-sluggable handle uniqueness, and can I customize the deduplication logic?

Frequently asked questions

What is laravel-sluggable?

A Laravel package that automatically creates clean, readable URL segments (slugs) from your content titles, with support for unique slugs, self-healing redirects, and multi-language sites.

What language is laravel-sluggable written in?

Mainly PHP. The stack also includes PHP, Laravel.

Is laravel-sluggable actively maintained?

Active — commit in last 30 days (last push 2026-07-28).

What license does laravel-sluggable use?

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

How hard is laravel-sluggable to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is laravel-sluggable for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.