tarekhasan/laravel-auto-slug

Automatically generate and manage unique slugs for Eloquent models

v1.0.0 2025-04-19 16:02 UTC

This package is auto-updated.

Last update: 2025-06-19 17:38:47 UTC


README

Laravel Auto Slug is a lightweight, easy-to-use Laravel package that automatically generates and manages unique slugs for your Eloquent models.

Perfect for blog posts, products, or any content type that needs clean, human-readable, SEO-friendly URLs.

๐Ÿ“ฆ Installation

composer require tarekhasan/laravel-auto-slug

---

## โš™๏ธ Usage

```use Illuminate\Database\Eloquent\Model;
use Tarekhasan\LaravelAutoSlug\Traits\AutoSlug;

class Post extends Model
{
    use AutoSlug;

    protected static function booted()
    {
        static::bootAutoSlug('title');
    }
}
---

## ๐Ÿง  Features
โœ… Automatically generates slugs for any Eloquent model field  
โœ… Ensures uniqueness even if titles are duplicated  
โœ… Simple and expressive syntax  
โœ… Fully customizable slug source field  
โœ… Works out-of-the-box with Laravel **8, 9, 10, and 11**

---

## ๐Ÿงช Coming Soon
- Support for localized slugs  
- Optional slug column name configuration  
- Slug regeneration control on updates  

---

## ๐Ÿ“„ License
Released under the [MIT license](LICENSE).  
Made with โค๏ธ by [Tarek Hasan](mailto:tarekhn175@gmail.com)

---

## ๐ŸŒŸ Contributing
PRs and stars are welcome!  
If you find this package useful, consider giving it a โญ๏ธ on [GitHub](https://github.com/tarekhn/laravel-auto-slug).