PHPackages                             laraeast/laravel-sluggable - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. laraeast/laravel-sluggable

ActivePackage

laraeast/laravel-sluggable
==========================

Easy creation of slugs for your Eloquent models in Laravel

v2.2.0(4y ago)64932MITPHPPHP ^7.3|^8.0CI failing

Since Jun 7Pushed 4y ago1 watchersCompare

[ Source](https://github.com/laraeast/laravel-sluggable)[ Packagist](https://packagist.org/packages/laraeast/laravel-sluggable)[ RSS](/packages/laraeast-laravel-sluggable/feed)WikiDiscussions master Synced yesterday

READMEChangelog (9)Dependencies (3)Versions (14)Used By (0)

Eloquent-Sluggable
==================

[](#eloquent-sluggable)

[![StyleCI](https://camo.githubusercontent.com/8ed18e619ed89ccd404c1fe4e9e2bc9c5d2ff004b24cdcaef80e8a307bc6c0a1/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3139303639303539312f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/190690591) [ ![Travis Build Status](https://camo.githubusercontent.com/f962e7bc4d007af61ca8f6cfed77a51b576f6946c24ca4c55f52e6774d4e05ff/68747470733a2f2f7472617669732d63692e6f72672f6c617261656173742f6c61726176656c2d736c75676761626c652e7376673f6272616e63683d6d6173746572) ](https://travis-ci.org/laraeast/laravel-sluggable) [ ![Circleci Build Status](https://camo.githubusercontent.com/7920337b9cfea62a225241dc82ed05dea1c959308bcb25d05a9c00cf4b4be4b9/68747470733a2f2f636972636c6563692e636f6d2f67682f6c617261656173742f6c61726176656c2d736c75676761626c652e706e673f7374796c653d736869656c64) ](https://circleci.com/gh/laraeast/laravel-sluggable) [ ![Total Downloads](https://camo.githubusercontent.com/675f29a9b504ba779de0f4e2f6339129d24e49c35b3bf33a698bf2310f500371/68747470733a2f2f706f7365722e707567782e6f72672f6c617261656173742f6c61726176656c2d736c75676761626c652f642f746f74616c2e737667) ](https://packagist.org/packages/laraeast/laravel-sluggable) [ ![Latest Stable Version](https://camo.githubusercontent.com/461086fa8be8abe9a3f0e3a65f70e09d752b17f533124f164edeeb6f0c1e9fbb/68747470733a2f2f706f7365722e707567782e6f72672f6c617261656173742f6c61726176656c2d736c75676761626c652f762f737461626c652e737667) ](https://packagist.org/packages/laraeast/laravel-sluggable) [ ![License](https://camo.githubusercontent.com/32a133993c70958c0d032d613b7e57880ab265cec232fcb33403d71196006efa/68747470733a2f2f706f7365722e707567782e6f72672f6c617261656173742f6c61726176656c2d736c75676761626c652f6c6963656e73652e737667) ](https://packagist.org/packages/laraeast/laravel-sluggable)

Easy creation of slugs for your Eloquent models in Laravel. Background: What is a slug?
---------------------------

[](#background-what-is-a-slug)

A slug is a simplified version of a string, typically URL-friendly. The act of "slugging" a string usually involves converting it to one case, and removing any non-URL-friendly characters (spaces, accented letters, ampersands, etc.). The resulting string can then be used as an identifier for a particular resource.

For example, if you have a blog with posts, you could refer to each post via the ID:

```
http://example.com/post/1
http://example.com/post/2

```

... but that's not particularly friendly (especially for [SEO](http://en.wikipedia.org/wiki/Search_engine_optimization)). You probably would prefer to use the post's title in the URL, if your post is titled "My Dinner With Ahmed &amp; Omar", the URL will be:

```
http://example.com/post/1-my-dinner-with-ahmed-omar

```

Installation
------------

[](#installation)

- Install the package via Composer:

    - For Laravel 5.2 &gt;= 6.x ```
        $ composer require laraeast/laravel-sluggable:^1.0
        ```
    - For Laravel 7.x ```
        $ composer require laraeast/laravel-sluggable:^2.0
        ```

    The package will automatically register its service provider.

Middleware
----------

[](#middleware)

You should add `SluggableRedirectMiddleware` to `web` middileware to redirect to latest updated slug. `app/Http/Kernel.php` file :

```
    /**
     * The application's route middleware groups.
     *
     * @var array
     */
    protected $middlewareGroups = [
        'web' => [
            ...
            \Laraeast\LaravelSluggable\SluggableRedirectMiddleware::class,
        ],
        ...
    ];
```

Updating your Eloquent Models
-----------------------------

[](#updating-your-eloquent-models)

Your models should use the Sluggable trait, which has an abstract method `sluggableFields()`that you need to define. This is where any model-specific configuration is set

```
use Laraeast\LaravelSluggable\Sluggable;

class Post extends Model
{
    use Sluggable;

    /**
     * The sluggable fields for model.
     *
     * @return array
     */
    public function sluggableFields()
    {
        return ['name'];
    }
}
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 92.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~67 days

Recently: every ~76 days

Total

12

Last Release

1790d ago

Major Versions

v0.1.0 → v1.0.02019-06-07

v1.0.5 → v2.0.02020-08-16

PHP version history (2 changes)2.x-devPHP ^7.3

v2.2.0PHP ^7.3|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/23261109?v=4)[Ahmed Fathy](/maintainers/ahmed-aliraqi)[@ahmed-aliraqi](https://github.com/ahmed-aliraqi)

---

Top Contributors

[![ahmed-aliraqi](https://avatars.githubusercontent.com/u/23261109?v=4)](https://github.com/ahmed-aliraqi "ahmed-aliraqi (25 commits)")[![AlShahawi](https://avatars.githubusercontent.com/u/5667648?v=4)](https://github.com/AlShahawi "AlShahawi (1 commits)")[![MagedAhmad](https://avatars.githubusercontent.com/u/12874132?v=4)](https://github.com/MagedAhmad "MagedAhmad (1 commits)")

### Embed Badge

![Health badge](/badges/laraeast-laravel-sluggable/health.svg)

```
[![Health](https://phpackages.com/badges/laraeast-laravel-sluggable/health.svg)](https://phpackages.com/packages/laraeast-laravel-sluggable)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[namu/wirechat

A Laravel Livewire messaging app for teams with private chats and group conversations.

54324.5k](/packages/namu-wirechat)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
