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

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

arniro/laravel-sluggable
========================

A package to generate a slug for Laravel models. Translatable columns are also supported.

0.1.3(5y ago)0956[3 PRs](https://github.com/arniro/laravel-sluggable/pulls)MITPHP

Since Jun 15Pushed 3y ago1 watchersCompare

[ Source](https://github.com/arniro/laravel-sluggable)[ Packagist](https://packagist.org/packages/arniro/laravel-sluggable)[ Docs](https://github.com/arniro/laravel-sluggable)[ RSS](/packages/arniro-laravel-sluggable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (8)Used By (0)

Generate a slug for your Eloquent models
========================================

[](#generate-a-slug-for-your-eloquent-models)

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

[](#installation)

Install the package via composer:

`composer require arniro/laravel-sluggable`

Usage
-----

[](#usage)

Include a `Sluggable` trait to the model:

```
use Arniro\Sluggable\Sluggable;
use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    use Sluggable;

    //
}
```

Whenever you create or update a model, a slug will be generated from the `name` column to the `slug` column by default.

```
Product::create([
    'name' => 'Lorem Ipsum'
]);
```

A `slug` column will be filled with the following value: `lorem-ipsum`. The slug value will always be unique.

You can override a column name that is used to generate a slug from with the `getSluggable` method:

```
use Arniro\Sluggable\Sluggable;
use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    use Sluggable;

    public function getSluggable()
    {
        return 'title';
    }

    //
}
```

Translatable columns
--------------------

[](#translatable-columns)

If your column is translatable and you use a [spatie/laravel-translatable](https://github.com/spatie/laravel-translatable) package it will be recognized and used behind the scenes so all you need to do is to add your slug column name to the `translatable` property of your model:

```
use Arniro\Sluggable\Sluggable;
use Illuminate\Database\Eloquent\Model;
use Spatie\Translatable\HasTranslations;

class Product extends Model
{
    use HasTranslations, Sluggable;

    public $translatable = ['name', 'slug'];

    //
}
```

So now if you're creating or updating a sluggable column, all of its locales will be slugged:

```
$product = Product::create([
    'name' => [
        'en' => 'Lorem Ipsum',
        'ru' => 'Lorem Ipsum Ru'
    ]
]);
$product->getTranslations('slug'); // ['en' => 'lorem-ipsum','ru' => 'lorem-ipsum-ru']
```

Testing
-------

[](#testing)

```
composer test

```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 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 ~57 days

Total

4

Last Release

1982d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/852353fa888009406642a75b0a792e9d1ba4b6da6b04277dba19b248951820d1?d=identicon)[Arniro](/maintainers/Arniro)

---

Top Contributors

[![arttemiuss43](https://avatars.githubusercontent.com/u/17377436?v=4)](https://github.com/arttemiuss43 "arttemiuss43 (7 commits)")

---

Tags

eloquentlaravelphplaravelsluggabletranslatable

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[cviebrock/eloquent-sluggable

Easy creation of slugs for your Eloquent models in Laravel

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

Rinvex Categories is a polymorphic Laravel package, for category management. You can categorize any eloquent model with ease, and utilize the power of Nested Sets, and the awesomeness of Sluggable, and Translatable models out of the box.

470161.6k3](/packages/rinvex-laravel-categories)[rinvex/laravel-tenants

Rinvex Tenants is a contextually intelligent polymorphic Laravel package, for single db multi-tenancy. You can completely isolate tenants data with ease using the same database, with full power and control over what data to be centrally shared, and what to be tenant related and therefore isolated from others.

823.4k10](/packages/rinvex-laravel-tenants)

PHPackages © 2026

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