PHPackages                             oleaass/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. oleaass/laravel-sluggable

ActiveLaravel-package

oleaass/laravel-sluggable
=========================

Add unique slugs to Eloquent models in Laravel

v1.1.1(4y ago)0902MITPHP

Since Apr 25Pushed 4y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (5)Used By (2)

Add slugs to Eloquent models in Laravel
=======================================

[](#add-slugs-to-eloquent-models-in-laravel)

This package allows you to automatically create and/or update slugs when saving Eloquent models.

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

[](#installation)

```
$ composer require oleaass/laravel-sluggable

```

Usage
-----

[](#usage)

### Make your Eloquent model sluggable

[](#make-your-eloquent-model-sluggable)

```
namespace App\Models;

use OleAass\Sluggable\Sluggable;

class Post extends Model
{
    use Sluggable;

    public function getSlugOptions() : array
    {
        return [
            'source' => 'title'
        ];
    }
}
```

### Example

[](#example)

```
$post = \App\Models\Post::create([
    'title' => 'My first post'
]);

echo $post->slug; // Output: my-first-post
```

### Options

[](#options)

These are the available options, with default values, which you can override via `getSlugOptions()` on your Eloquent model.

```
[
    'source'            => 'title', // The field used as source for the slug
    'dest'              => 'slug',  // Name of the slug column
    'onCreate'          => true,    // If true, automatically create slug when creating a new resource
    'onUpdate'          => false,   // If true, automatically change slug when updating an existing resource
    'allowOverwrite'    => true,    // If true, overwrite existing slug when updating a resource
    'allowDuplicate'    => false,   // If true, non unique slugs can be created (recommended to be false always)
    'delimiter'         => '-',     // Replace spaces with this
];
```

Support Me
----------

[](#support-me)

I spend my free time making packages. So if you want to support me and my work, I would really appreciate if you bough me a coffee.

[![Buy Me A Coffee](https://camo.githubusercontent.com/9f44ce2dc3b3eecdd02598900866ffc518801df1932849703dae1e5ce5031070/68747470733a2f2f7777772e6275796d6561636f666665652e636f6d2f6173736574732f696d672f637573746f6d5f696d616765732f6f72616e67655f696d672e706e67)](https://www.buymeacoffee.com/oleaass)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

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

Total

3

Last Release

1542d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/46921124?v=4)[Ole Aass](/maintainers/oleaass)[@oleaass](https://github.com/oleaass)

---

Top Contributors

[![oleaass](https://avatars.githubusercontent.com/u/46921124?v=4)](https://github.com/oleaass "oleaass (8 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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