---
title: "Sluggable for Laravel — docs | Roundly"
description: "Developer docs for Sluggable for Laravel: multi-language slugs, scoped uniqueness with native indexes, locale-aware route binding and 301 slug history."
url: https://roundly-consulting.com/open-source/docs/sluggable-for-laravel
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

Open source

# Sluggable for Laravel

Install

`composer require roundly-consulting/sluggable-for-laravel`

Requires: PHP ^8.4 · Laravel ^12.0|^13.0

[GitHub](https://github.com/roundly-consulting/sluggable-for-laravel) [Packagist](https://packagist.org/packages/roundly-consulting/sluggable-for-laravel) [Donate (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Patreon](https://www.patreon.com/cw/roundly)

## Overview

Single- and multi-language slugs for Eloquent. Store a plain string slug or a json/jsonb locale map with one slug per language, declare any number of slug columns per model, and keep them unique globally or per scope — enforced by engine-native unique indexes. On top come locale-aware route model binding, validation rules, Artisan tooling and an optional slug history that 301-redirects old URLs. Built only on Laravel and two small Roundly packages, MIT-licensed, with zero third-party runtime dependencies — and with the default options every slug matches Str::slug() for ordinary input of up to 255 characters.

### What you get

#### Locale-map slugs

Plain string slugs or json/jsonb locale maps — one slug per language, each transliterated by that language’s rules.

#### Str::slug() compatible

With the default options every slug matches Str::slug() for ordinary input of up to 255 characters, so adopting the package keeps the URLs you already have.

#### Race-safe uniqueness

Unique globally, per tenant or per parent — backed by engine-native unique indexes and an automatic retry when two writers collide.

#### Locale-aware routing

Implicit, scoped and soft-deleted route bindings resolve by slug in the current locale, with an optional primary-key fallback.

#### SEO slug history

Retired slugs 301-redirect to the current URL without revealing drafts, trashed rows or other tenants’ records.

#### Policies & locks

Decide how updates, hand-typed slugs and empty sources behave, and freeze a slug once a page is published.

#### Facade, DI or Artisan

Slugs::model(Product::class) backfills slugs, audits duplicates and builds indexes — or inject SlugManager, run an action or use Artisan.

### Documentation

#### [Installation](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/installation.md)

Install via Composer; publish the config, translations and slug-history migration only when you need them.

#### [Configuration](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/configuration.md)

Every config key with its default and env variable — formatting, uniqueness, update policy, locales, limits, retries and history.

#### [Quick start](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/quick-start.md)

Add the HasSlug trait and the Sluggable contract — with zero config, a unique slug is generated from name on create.

#### [Slug definitions](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/slug-definitions.md)

Declare any number of slug columns with slugOptions() or #\[Slug\] attributes — sources, formatting, uniqueness, lifecycle and routing.

#### [The Slugs facade](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/facade.md)

One entry point for everything that is not a model hook — flat verbs for one model, and Slugs::model(Product::class) for class-wide work.

#### [DI and actions](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/without-facade.md)

Inject SlugManager for the facade’s API without static calls, or run the action behind a method directly with its DTO.

#### [Formatting & suffixes](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/formatting.md)

How the pipeline transliterates, strips and truncates — plus separators, affixes, reserved words, custom sluggers and collision suffixes.

#### [Locale maps](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/locale-maps.md)

Multi-language slugs in one json/jsonb column — per-locale transliteration, target locales, fallback chains and your own locale source.

#### [Update, manual & lock policies](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/lifecycle.md)

Control when slugs regenerate, how hand-typed values are treated, what an empty source does, and how to freeze a slug.

#### [Uniqueness & concurrency](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/uniqueness.md)

Global, scoped or closure-based uniqueness, soft-delete handling, bounded probing and an automatic retry when two writers collide.

#### [Schema & unique indexes](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/indexes.md)

Blueprint macros for slug columns and engine-native unique indexes for string and locale-map slugs on PostgreSQL, MySQL and SQLite.

#### [Querying](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/querying.md)

Find models by slug — exact locale or the fallback chain, any locale, lists — with scopes that stay safe for count() and paginate().

#### [Route model binding](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/routing.md)

Implicit, custom-column, scoped and soft-deleted route binding by slug, locale-aware URLs and an optional primary-key fallback.

#### [Slug history & redirects](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/history.md)

Keep retired slugs and 301-redirect old URLs to the current one — without revealing drafts, trashed rows or other tenants’ records.

#### [Validation](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/validation.md)

UniqueSlug and ValidSlug rules with the exact generation semantics — scoped, locale-aware and safe against cross-tenant probing.

#### [Events & exceptions](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/events.md)

SlugChanged, SlugCollisionRetried and SlugsRegenerated events, plus the typed exception hierarchy behind every failure.

#### [Artisan commands](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/commands.md)

Backfill and regenerate slugs, create engine-native indexes, and audit duplicates before adding a unique index.

#### [Adoption & limitations](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/adoption.md)

Map the options of an existing slug setup onto sluggable, compose it with other traits, and know exactly where its limits are.

#### [Testing](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/testing.md)

Test slug generation, events, history redirects and queued regeneration in your own Pest suite through the public API — no special setup.

#### [Requirements](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/requirements.md)

PHP 8.4+ with ext-json and ext-mbstring, Laravel 12 or 13, and PostgreSQL or MySQL/MariaDB (SQLite for tests).

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source.md)
