PHPackages                             michaeljmeadows/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. michaeljmeadows/sluggable

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

michaeljmeadows/sluggable
=========================

A simple trait to generate model slugs.

v2.0.0(2y ago)013MITPHPPHP ^8.0

Since Nov 10Pushed 2y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

michaeljmeadows/sluggable
=========================

[](#michaeljmeadowssluggable)

A simple trait to generate model slugs.

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

[](#installation)

You can install the package via composer:

```
composer require michaeljmeadows/sluggable

```

Usage
-----

[](#usage)

Add a slug field to the migration for the model for which you'd like to generate slugs:

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

Once the migration has been updated, you can simply include the trait in your model's definition and define which other fields should be used with a protected array `$slugFields`:

```
