Introduction | laravel-sluggable-rust | Spatie       

 SPATIE  

  Laravel Sluggable 
====================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-sluggable-rust](https://spatie.be/docs/laravel-sluggable-rust/v1)  Introduction

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/laravel-sluggable-rust/v1) 

  Introduction    
- [ Introduction ](https://spatie.be/docs/laravel-sluggable-rust/v1/introduction)
- [ Requirements ](https://spatie.be/docs/laravel-sluggable-rust/v1/requirements)
- [ Support us ](https://spatie.be/docs/laravel-sluggable-rust/v1/support-us)
- [ Installation and setup ](https://spatie.be/docs/laravel-sluggable-rust/v1/installation-setup)
- [ Translatable slugs ](https://spatie.be/docs/laravel-sluggable-rust/v1/translatable-slugs)
- [ Changelog ](https://spatie.be/docs/laravel-sluggable-rust/v1/changelog)
- [ Questions and issues ](https://spatie.be/docs/laravel-sluggable-rust/v1/questions-issues)
- [ Upgrading ](https://spatie.be/docs/laravel-sluggable-rust/v1/upgrading)
- [ Testing ](https://spatie.be/docs/laravel-sluggable-rust/v1/testing)
- [ Releasing ](https://spatie.be/docs/laravel-sluggable-rust/v1/releasing)

Basic usage
-----------

- [ Generating your first slug ](https://spatie.be/docs/laravel-sluggable-rust/v1/basic-usage/getting-started)
- [ Using slug options ](https://spatie.be/docs/laravel-sluggable-rust/v1/basic-usage/using-slug-options)
- [ Finding models by slug ](https://spatie.be/docs/laravel-sluggable-rust/v1/basic-usage/finding-models-by-slug)
- [ Self-healing URLs ](https://spatie.be/docs/laravel-sluggable-rust/v1/basic-usage/self-healing-urls)

Advanced usage
--------------

- [ Combining multiple source columns ](https://spatie.be/docs/laravel-sluggable-rust/v1/advanced-usage/source-fields)
- [ Tuning the uniqueness suffix ](https://spatie.be/docs/laravel-sluggable-rust/v1/advanced-usage/uniqueness)
- [ Overriding the underlying actions ](https://spatie.be/docs/laravel-sluggable-rust/v1/advanced-usage/overriding-actions)

 Laravel Sluggable 
===================

Generate slugs when saving Eloquent models 
-------------------------------------------

 An opinionated package to create slugs for Eloquent models 

 [    Repository ](https://github.com/spatie/laravel-sluggable-rust) 

 [    Open Issues ](https://github.com/spatie/laravel-sluggable-rust/issues) 

    0 

    0 

Introduction
------------

###  On this page 

1. [ Self-healing URLs at a glance ](#content-self-healing-urls-at-a-glance)

This package generates a unique slug for any Laravel Rust model whenever it is created or updated. Define the model's slug options and connect them to Laravel's native hooks.

```
let post = create!(Post { title: "activerecord is awesome" }).await?;
assert_eq!(post.slug.as_deref(), Some("activerecord-is-awesome"));
```

Slugs are produced by Laravel's string helpers with language-specific transliteration, lowercasing, and a configurable separator.

Head to [Generating your first slug](basic-usage/getting-started) for the migration, the model, and the route binding in one walkthrough.

On top of generation, this package also ships:

- Self-healing URLs, with route keys that combine the slug with the primary key so changing a slug never breaks existing links.
- Translatable slugs, stored in locale-keyed JSON columns.
- Overridable actions for slug generation and self-healing URL formatting and parsing.

Self-healing URLs at a glance
-----------------------------------------------------------------------------------------------------------------------------------------------

Rename a post and its URL changes with it. Every bookmark, search result, and shared link pointing at the old URL now returns a `404`.

Self-healing route keys use `{slug}-{id}`. The primary key resolves the model, so the slug can change without breaking lookups. Old URLs return a `308` redirect to the current one.

Read the full story in [Self-healing URLs](basic-usage/self-healing-urls).

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
