kduma/eloquent-sluggable

Eases using and generating slugs Laravel Eloquent models.
870 2
Install
composer require kduma/eloquent-sluggable
Latest Version:v3.0.0
PHP:^8.3
License:MIT
Last Updated:Apr 8, 2026
Links: GitHub  ·  Packagist
Maintainer: kduma

Eloquent Sluggable

Latest Stable Version Total Downloads License

Eloquent trait for automatically generating unique slugs for Laravel models.

Full documentation: opensource.duma.sh/libraries/php/eloquent-sluggable

Requirements

  • PHP ^8.3
  • Laravel ^13.0

Installation

composer require kduma/eloquent-sluggable

Usage

use KDuma\Eloquent\Sluggable;
use KDuma\Eloquent\Attributes\HasSlug;

#[HasSlug(from: 'title', field: 'slug')]
class Post extends Model
{
    use Sluggable;
}

Add a slug column to your migration:

$table->string('slug')->unique();

Slug is auto-generated on create. Find by slug with Post::whereSlug($slug).

Related Packages

expstudio/friendly-url

Easy creation of slugs or friendly url for your Eloquent models in Laravel 4 wit...

68 0
rolies106/eloquent-sluggable

Easy creation of slugs for your Eloquent models in Laravel

105 2
spatie/laravel-sluggable

Generate slugs when saving Eloquent models

13,300,010 1,552
cviebrock/eloquent-sluggable

Easy creation of slugs for your Eloquent models in Laravel

14,497,595 3,995
harran/slugit

Slugit is a laravel slug generator for eloquent models with support for all lang...

77 2