PHPackages                             kduma/eloquent-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. [Database &amp; ORM](/categories/database)
4. /
5. kduma/eloquent-sluggable

ActiveLibrary[Database &amp; ORM](/categories/database)

kduma/eloquent-sluggable
========================

Eases using and generating slugs Laravel Eloquent models.

v2.3.0(1y ago)2799MITPHPPHP &gt;=7.4CI failing

Since Jan 31Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/kduma-OSS/LV-eloquent-sluggable)[ Packagist](https://packagist.org/packages/kduma/eloquent-sluggable)[ RSS](/packages/kduma-eloquent-sluggable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (3)Versions (13)Used By (0)

L5-eloquent-sluggable
=====================

[](#l5-eloquent-sluggable)

[![Latest Stable Version](https://camo.githubusercontent.com/c6fa472cde348fde43babc81f0419bf2ffa23a6a3e4991bd1f04b69629979813/68747470733a2f2f706f7365722e707567782e6f72672f6b64756d612f656c6f7175656e742d736c75676761626c652f762f737461626c652e737667)](https://packagist.org/packages/kduma/eloquent-sluggable)[![Total Downloads](https://camo.githubusercontent.com/56433a3caf034c7a363a40a7803af73e2b298c51642a55fc508d64f31b3784f8/68747470733a2f2f706f7365722e707567782e6f72672f6b64756d612f656c6f7175656e742d736c75676761626c652f646f776e6c6f6164732e737667)](https://packagist.org/packages/kduma/eloquent-sluggable)[![Latest Unstable Version](https://camo.githubusercontent.com/a2d3b6faa0f19eab18c54c118596da8e619de2a149506beb79329788af0db9fe/68747470733a2f2f706f7365722e707567782e6f72672f6b64756d612f656c6f7175656e742d736c75676761626c652f762f756e737461626c652e737667)](https://packagist.org/packages/kduma/eloquent-sluggable)[![License](https://camo.githubusercontent.com/fa017a2bf7eeb554081861000cf14ba5bb83803c1192755d4a7f4d303a873198/68747470733a2f2f706f7365722e707567782e6f72672f6b64756d612f656c6f7175656e742d736c75676761626c652f6c6963656e73652e737667)](https://packagist.org/packages/kduma/eloquent-sluggable)[![SensioLabsInsight](https://camo.githubusercontent.com/107b64a37e6eebacc7722bf3670133e233234517fcbb833583e1bdda9b46de96/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f35636335316164362d363036632d343364352d626233622d3666306262646536316464302f6d696e692e706e67)](https://insight.sensiolabs.com/projects/5cc51ad6-606c-43d5-bb3b-6f0bbde61dd0)[![StyleCI](https://camo.githubusercontent.com/d7f0f4bc0da36779faa7005d6f8d1a23299683c6f0b57376f251c936cf2b8548/68747470733a2f2f7374796c6563692e696f2f7265706f732f33303131363239392f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/30116299)[![Build Status](https://camo.githubusercontent.com/18930660a0775402613ee47bb9fae6a2b46b7dcc6ca142d93b4e88b49575f823/68747470733a2f2f7472617669732d63692e6f72672f6b64756d612f4c352d656c6f7175656e742d736c75676761626c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/kduma/L5-eloquent-sluggable)

Eases using and generating slugs Laravel Eloquent models.

Check full documentation here: [opensource.duma.sh/libraries/php/eloquent-sluggable](https://opensource.duma.sh/libraries/php/eloquent-sluggable)

Setup
=====

[](#setup)

Add the package to the require section of your composer.json and run `composer update`

```
"kduma/eloquent-sluggable": "^1.1"

```

Prepare models
==============

[](#prepare-models)

Inside your model (not on top of file) add following lines:

```
use \KDuma\Eloquent\Slugabble;

```

Optionally you can add also `SluggableString` function which will return string from which slug will be made (default it uses `title` field):

```
protected function SluggableString(){
    return $this->year.' '.$this->title;
}

```

In database create `slug` string field. If you use migrations, you can use following snippet:

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

```

Usage
=====

[](#usage)

By default it generates slug on first save.

- `$model->newSlug()` - Generate new slug. (Remember to save it by yourself)
- `Model::whereSlug($slug)->first()` - Find by slug. (`whereSlug` is query scope)

Eric L. Barnes
==============

[](#eric-l-barnes)

A special thanks to [Eric L. Barnes](https://dotdev.co/creating-unique-title-slugs-with-laravel/), an original code creator that this package is based on.

Packagist
=========

[](#packagist)

View this package on Packagist.org: [kduma/eloquent-sluggable](https://packagist.org/packages/kduma/eloquent-sluggable)

###  Health Score

41

—

FairBetter than 88% of packages

Maintenance57

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~368 days

Recently: every ~411 days

Total

11

Last Release

428d ago

Major Versions

v1.1.0 → v2.02017-05-21

PHP version history (2 changes)v1.0.0PHP &gt;=5.4.0

v2.0.3PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/d09451622719c7efce1a7971b8e5a875859504882ba2b8c279d1015a99e8f12c?d=identicon)[kduma](/maintainers/kduma)

---

Top Contributors

[![kduma](https://avatars.githubusercontent.com/u/1062582?v=4)](https://github.com/kduma "kduma (39 commits)")

---

Tags

laravelphpsluglaraveleloquent

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kduma-eloquent-sluggable/health.svg)

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

###  Alternatives

[cviebrock/eloquent-sluggable

Easy creation of slugs for your Eloquent models in Laravel

4.0k13.6M251](/packages/cviebrock-eloquent-sluggable)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[highsolutions/eloquent-sequence

A Laravel package for easy creation and management sequence support for Eloquent models with elastic configuration.

121130.3k](/packages/highsolutions-eloquent-sequence)[toponepercent/baum

Baum is an implementation of the Nested Set pattern for Eloquent models.

3154.7k](/packages/toponepercent-baum)

PHPackages © 2026

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