PHPackages                             alzpk/laraslug - 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. alzpk/laraslug

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

alzpk/laraslug
==============

Small package that it easy to create slug for laravel models

1.0.0(4y ago)05MITPHPPHP ^7.3|^8.0

Since Apr 26Pushed 4y ago1 watchersCompare

[ Source](https://github.com/alzpk/laraslug)[ Packagist](https://packagist.org/packages/alzpk/laraslug)[ RSS](/packages/alzpk-laraslug/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

Laraslug
========

[](#laraslug)

Small package that makes it easy to create slug for laravel models

### Installation

[](#installation)

To install this package, run the following composer command, inside your laravel project.

```
composer require alzpk/laraslug
```

### Usage

[](#usage)

To use this package simply use `Alzpk\Laraslug` inside your model.

**Example:**

```
namespace App\Models;

use Alzpk\Laraslug\Laraslug;
use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    use Laraslug;
}
```

**The example above expects your model to have at least one of each columns listed below:**

*Slug column (the column name, which should hold the slug value):*

- slug

*Slug value column (the column name, which holds the value that should be slugged):*

- title
- name

### Advanced usage

[](#advanced-usage)

If you want to customize one or more of the columns, and perhaps want a prefix for the slug, you can make use of these variables, inside your model:

- Custom slug column: `private string $slugColumn`
- Custom slug value column: `private string $slugValueColumn`
- Add prefix to the slug: `private string $slugPrefix`

**Example:**

Here we have an example of a migration and model, called `Post` that has the columns `subject` and `uri`.

```
public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->id();
            $table->string('subject');
            $table->string('uri');
            $table->timestamps();
        });
    }
```

To make the slug work now we simply have to add `private string $slugColumn` and `private string $slugValueColumn` to the model.

```
namespace App\Models;

use Alzpk\Laraslug\Laraslug;
use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    use Laraslug;

    private string $slugColumn = 'uri';
    private string $slugValueColumn = 'subject';
}
```

**Prefix:**

If we want to add a prefix to our slug, we just need to add `private string $slugPrefix` to our model.

```
namespace App\Models;

use Alzpk\Laraslug\Laraslug;
use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    use Laraslug;

    private string $slugPrefix = 'prefix';
}
```

This would then make a slug like so "prefix-VALUE".

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Unknown

Total

1

Last Release

1528d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ce3d518bda28b34b8f8edbd7be003f25706e51fa3d1f8a80c523dbf99a5d2c47?d=identicon)[alzpk](/maintainers/alzpk)

---

Top Contributors

[![alzpk](https://avatars.githubusercontent.com/u/25452420?v=4)](https://github.com/alzpk "alzpk (3 commits)")

### Embed Badge

![Health badge](/badges/alzpk-laraslug/health.svg)

```
[![Health](https://phpackages.com/badges/alzpk-laraslug/health.svg)](https://phpackages.com/packages/alzpk-laraslug)
```

###  Alternatives

[webdevstudios/taxonomy_core

A tool to make custom taxonomy registration just a bit simpler. Automatically registers taxonomy labels, and provides helpful methods.

384.0k1](/packages/webdevstudios-taxonomy-core)

PHPackages © 2026

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