PHPackages                             echoamirali/slugger - 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. echoamirali/slugger

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

echoamirali/slugger
===================

Make standard slug

011PHP

Since Aug 2Pushed 3y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Make standard slug
==================

[](#make-standard-slug)

[![Latest Version on Packagist](https://camo.githubusercontent.com/21165c924758973fd5e2f63fcc6ba4ce4e43a94c98319713d1106efdbc4a366f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6563686f616d6972616c692f736c75676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/echoamirali/slugger)[![Total Downloads](https://camo.githubusercontent.com/2e53f4a368ba33ead7a9befb8c18cf9878a4083e9f09f3b20aa832dd018f3cf5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6563686f616d6972616c692f736c75676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/echoamirali/slugger)

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

[](#installation)

### Step 1

[](#step-1)

- **Method 1**: You can install the package via composer:

```
composer require echoamirali/slugger
```

- **Method 2**: Add this line to **Composer.json** file in your project:

```
"echoamirali/slugger": "*"
```

Then run following command to download extension using **composer**

```
$ composer update
```

### Step 2

[](#step-2)

Open the **config/app.php** file and add this line to the end of **providers** Array:

```
Echoamirali\Slugger\SluggerServiceProvider::class,
```

### Step 3

[](#step-3)

Then in the **config/app.php** and add this line to the end of **aliases** Array:

```
'Slugger' => Echoamirali\Slugger\SluggerFacade::class,
```

### Step 4

[](#step-4)

Run this command in your project dirctory:

```
php artisan vendor:publish
```

In the message appear, find the number of Slugger, enter the related number then hit Enter.

### Step 5

[](#step-5)

You can configure package, for this head to **config/slugger.php**

```
return [
    /**
     * if do initail option is true, package do some operations on your string like
     * trims spaces, changes characters to lowercase , changes spaces to hyphen, ...
    **/
    'do_initial' => false,
    /**
     * if do translate option is true, package translate your string from 'translate_from'
     * option to 'translate_to' option at the first even before do initial
    **/
    'do_translate' => false,
    'translate_from' => 'fa',
    'translate_to' => 'en',
    /**
     * if do pattern option is true, package implement your string into
     * your pattern define in pattern option instead of #string#
    **/
    'do_pattern' => false,
    'pattern' => '',
    /**
     * first of all you should know remain options only use in laravel models for
     * avoid repetition and when you put true in 'is_unique' option they work
    **/
    'is_unique' => false,
    // put your database column in this option, that you want be unique
    'field' => 'slug',
    /**
     * this package use some symbols for avoid repetition and you can
     * choose which you want and put it in 'iteration_symbol' option.
     * available options for iteration_symbol are :
     * decimal, decimal_leading_zero, roman, numbers_in_word, ordinal_number
     **/
    'iteration_symbol' => 'decimal',
    //you can add your custom symbols in this option like alphabet
    'custom_iteration_symbols' => [
        'alphabet' => range('a', 'z')
    ]
];
```

Usage
-----

[](#usage)

You can use the package where ever you want.

First use the class:

```
use Slugger;
```

Then use this pattern to slugify your string:

```
$slug = Slugger::make($string);
```

Slugger 'make' method has two optional parameters then you can use when you dont want to use config file or merge some options to config file options

```
/** this parameter has three available options
 * config_file : this is default option and when you choose this option, package use config file options
 * config_options : when you choose this option, you can put your options in config_options parameter
 * config_mixed : when you choose this option, you can put your options in config_options parameter and package merge your options with config file options
**/
$config_status = 'config_options';
// when you choose option except config_file, you should put your options in this parameter
$config_options = ['do_initial' => false, 'do_translate' => false];
$slug = Slugger::make($string, $config_status, $config_options);
```

Also you can use Slugger in your models.

First use the trait:

```
use Echoamirali\Slugger\Traits\Slugger;
```

Then use Slugger trait in your model:

```
class Post extends Model {

    use Slugger;

}
```

If you want to use Slugger for some models with different options, you can define specific options for any model.

```
class Post extends Model {

    use Slugger;

    public $slugger_config = [];
}
```

Put your model config like slugger config file structure in slugger config property. For Example if you add only is\_unique option in slugger config property package use remain option from slugger config file.

### Changelog

[](#changelog)

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

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

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

Credits
-------

[](#credits)

- [AmirAli](https://github.com/echoamirali)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/04ec2fe67e83e037ba994a0116472d64bc3b3474d85b44c5f233a7b0002b563c?d=identicon)[echoamirali](/maintainers/echoamirali)

---

Top Contributors

[![echoamirali](https://avatars.githubusercontent.com/u/45933598?v=4)](https://github.com/echoamirali "echoamirali (120 commits)")

### Embed Badge

![Health badge](/badges/echoamirali-slugger/health.svg)

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

PHPackages © 2026

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