kduma/eloquent-sluggable
Eloquent Sluggable
Eloquent trait for automatically generating unique slugs for Laravel models.
Full documentation: opensource.duma.sh/libraries/php/eloquent-sluggable
Requirements
- PHP
^8.3 - Laravel
^13.0
Installation
composer require kduma/eloquent-sluggable
Usage
use KDuma\Eloquent\Sluggable;
use KDuma\Eloquent\Attributes\HasSlug;
#[HasSlug(from: 'title', field: 'slug')]
class Post extends Model
{
use Sluggable;
}
Add a slug column to your migration:
$table->string('slug')->unique();
Slug is auto-generated on create. Find by slug with Post::whereSlug($slug).
Related Packages
expstudio/friendly-url
Easy creation of slugs or friendly url for your Eloquent models in Laravel 4 wit...
68
0
cviebrock/eloquent-sluggable
Easy creation of slugs for your Eloquent models in Laravel
15,357,927
3,994
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v3.0.0 | ^8.3 | ^13.0 | MIT | |
| v2.4.0 | >=7.4 | 7.*| | MIT | |
| v2.3.0 | >=7.4 | 7.*| | MIT | |
| v2.2.0 | >=7.4 | 7.*| | MIT | |
| v2.1.0 | >=7.4 | 7.*| | MIT | |
| v2.0.3 | >=7.4 | 7.*| | MIT | |
| v2.0.1 | >=5.4.0 | 5.*| | MIT | |
| v2.0 | >=5.4.0 | 5.* | MIT | |
| v1.1.0 | >=5.4.0 | 5.* | MIT | |
| v1.0.3 | >=5.4.0 | 5.0.* | MIT | |
| v1.0.2 | >=5.4.0 | 5.0.* | MIT | |
| v1.0.1 | >=5.4.0 | 5.0.* | MIT | |
| v1.0.0 | >=5.4.0 | 5.0.* | MIT |