PHPackages                             flagstudio/nova-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. flagstudio/nova-sluggable

ActiveLibrary

flagstudio/nova-sluggable
=========================

Slug field for Laravel Nova

1.2.7(2y ago)08MITPHPPHP &gt;=7.1.0

Since Feb 28Pushed 2y agoCompare

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

READMEChangelogDependencies (2)Versions (2)Used By (0)

Slug field for Laravel Nova
===========================

[](#slug-field-for-laravel-nova)

[![Latest Version on Packagist](https://camo.githubusercontent.com/78bd655ce16f32d1aa5674d56b06bff3ce88a6ad95b0317a5e50b786a9e177e3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64726f6265652f6e6f76612d736c75676761626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/drobee/nova-sluggable)

Slug field for Laravel Nova that can generate unique slug for your model while typing.

[![nova-sluggable demo](https://camo.githubusercontent.com/41f9a02877feb6dd3a1a69ae109e6849dd63db629e08677f8ade9221e1fe5b49/68747470733a2f2f64726f6265652e6769746875622e696f2f6e6f76612d736c75676761626c652e676966)](https://camo.githubusercontent.com/41f9a02877feb6dd3a1a69ae109e6849dd63db629e08677f8ade9221e1fe5b49/68747470733a2f2f64726f6265652e6769746875622e696f2f6e6f76612d736c75676761626c652e676966)

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

[](#installation)

You can install the package in to a Laravel app that uses [Nova](https://nova.laravel.com) via composer:

```
composer require drobee/nova-sluggable
```

Usage
-----

[](#usage)

Add a new `SluggableText` and a `Slug` field to your Nova Resource:

```
use Drobee\NovaSluggable\SluggableText;
use Drobee\NovaSluggable\Slug;

class User extends Resource
{
    // ...

    public function fields(Request $request)
    {
        return [
            // ...

            SluggableText::make('Title'),
            Slug::make('Slug'),

            // ...
        ];
    }
}
```

When the user types a string in the `SluggableText` field the value is being sent the API to generate the slug and and then it sets the `Slug` field's value to the that. The slug is updated on every `key up` event, but it can be tied to `blur` event on the title field.

By default it looks for a `Slug` type field with the name Slug.

In order to work properly every defined `SluggableText` field need a corresponding `Slug` field.

Options
-------

[](#options)

#### Slug field with custom name

[](#slug-field-with-custom-name)

Set the `Slug` fields name on the `SluggableText` field with the `slug()` method:

```
SluggableText::make('Title')->slug('SEO Title');
Slug::make('SEO Title', 'slug');
```

#### Language

[](#language)

Set the language to use for the generation with the `Slug` field's `slugLanguage()` method:

```
Slug::make('Slug')->slugLanguage('hu');
```

Default value: `en`

#### Maximum length

[](#maximum-length)

Limit the maximum length of the generated slug with the `Slug` field's `slugMaxLength()` method:

```
Slug::make('Slug')->slugMaxLength(100);
```

Default value: `255`

#### Maximum length

[](#maximum-length-1)

Set the string all the whitespaces will be replaced with with the `Slug` field's `slugSeparator()` method:

```
Slug::make('Slug')->slugSeparator('.');
```

Default value: `-`

Note: the generated slug may be few characters longer than the value specified, due to the suffix which is added to make it unique.

#### Update event

[](#update-event)

By default the slug updates on every `keyup` event, but you can tie it to the `blur` event:

```
Slug::make('Slug')->event('blur');
```

Accepted values: `keyup`, `blur`

Default value: `keyup`

#### Unique slug and Eloquent model

[](#unique-slug-and-eloquent-model)

The generated slugs won't be unique unless you call the `slugUnique()` method on your `Slug` field.

You also need to specify what Eloquent model should the generator use to make the slug unique by calling the `slugModel()` method. In most cases you would want to use the same Eloquent model as your resource. To do so call the method with the resource's static `$model` attribute.

```
Slug::make('Slug')
    ->slugUnique()
    ->slugModel(static::$model);
```

When these to options are set the generated slug will be unique on the set model regarding the attribute value of the `Slug` field.

#### Usage with [Spatie\\Sluggable](https://github.com/spatie/laravel-sluggable)

[](#usage-with-spatiesluggable)

If the Eloquent model you specified with `slugModel()` uses `Spatie\Sluggable`'s `HasSlug` trait and implements its `getSlugOptions()` method, then you don't have to set the separator, maximum length or language for the field. In such cases the generator uses the values you already set on your model.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Robert Dezso](https://github.com/drobee)

License
-------

[](#license)

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

Acknowledgments
---------------

[](#acknowledgments)

Special thanks to:

- [Spatie](https://github.com/spatie) for [laravel-sluggable](https://github.com/spatie/laravel-sluggable)
- [Benjamin Hirsch](https://github.com/benjaminhirsch) for [nova-slug-field](https://github.com/benjaminhirsch/nova-slug-field)

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 54.8% 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

Unknown

Total

1

Last Release

808d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/12d17ea2c22cc2f91d54aed0b98914b5435925122f85905eba11f2a8b46d6f15?d=identicon)[flagstudio](/maintainers/flagstudio)

---

Top Contributors

[![drobee](https://avatars.githubusercontent.com/u/2998645?v=4)](https://github.com/drobee "drobee (23 commits)")[![marcreichel](https://avatars.githubusercontent.com/u/7645035?v=4)](https://github.com/marcreichel "marcreichel (3 commits)")[![CookiesEater](https://avatars.githubusercontent.com/u/1815942?v=4)](https://github.com/CookiesEater "CookiesEater (3 commits)")[![Back1ng](https://avatars.githubusercontent.com/u/50419205?v=4)](https://github.com/Back1ng "Back1ng (3 commits)")[![kukac7](https://avatars.githubusercontent.com/u/1240104?v=4)](https://github.com/kukac7 "kukac7 (2 commits)")[![mdavis1982](https://avatars.githubusercontent.com/u/199807?v=4)](https://github.com/mdavis1982 "mdavis1982 (1 commits)")[![u12206050](https://avatars.githubusercontent.com/u/6641242?v=4)](https://github.com/u12206050 "u12206050 (1 commits)")[![alexhiggins](https://avatars.githubusercontent.com/u/20141155?v=4)](https://github.com/alexhiggins "alexhiggins (1 commits)")[![wize-wiz](https://avatars.githubusercontent.com/u/9093559?v=4)](https://github.com/wize-wiz "wize-wiz (1 commits)")[![bashgeek](https://avatars.githubusercontent.com/u/4669888?v=4)](https://github.com/bashgeek "bashgeek (1 commits)")[![crynobone](https://avatars.githubusercontent.com/u/172966?v=4)](https://github.com/crynobone "crynobone (1 commits)")[![guillaumesozen](https://avatars.githubusercontent.com/u/24542418?v=4)](https://github.com/guillaumesozen "guillaumesozen (1 commits)")[![kduma](https://avatars.githubusercontent.com/u/1062582?v=4)](https://github.com/kduma "kduma (1 commits)")

---

Tags

laravelnova

### Embed Badge

![Health badge](/badges/flagstudio-nova-sluggable/health.svg)

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

###  Alternatives

[tzsk/sms

A robust and unified SMS gateway integration package for Laravel, supporting multiple providers.

320244.3k6](/packages/tzsk-sms)[datomatic/nova-enum-field

A Laravel Nova PHP 8.1 enum field with filters

20134.2k](/packages/datomatic-nova-enum-field)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[kerigard/laravel-lang-ru

Ru lang for Laravel

2116.8k](/packages/kerigard-laravel-lang-ru)[truckersmp/steam-socialite

Laravel Socialite provider for Steam OpenID.

1516.7k](/packages/truckersmp-steam-socialite)

PHPackages © 2026

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