PHPackages                             skeeks/yii2-slug-behavior - 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. skeeks/yii2-slug-behavior

ActiveYii2-extension

skeeks/yii2-slug-behavior
=========================

Yii2 slug behavior

1.0.0(8y ago)441.8k↓47.7%2GPL-3.0+PHP

Since Nov 4Pushed 7y ago1 watchersCompare

[ Source](https://github.com/skeeks-semenov/yii2-slug-behavior)[ Packagist](https://packagist.org/packages/skeeks/yii2-slug-behavior)[ Docs](https://skeeks.com/)[ RSS](/packages/skeeks-yii2-slug-behavior/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (2)

Yii2 slug behavior (Semantic URL)
=================================

[](#yii2-slug-behavior-semantic-url)

This solution allows you to generate good slug urls. ([slug wiki](https://en.wikipedia.org/wiki/Semantic_URL)).

Direct generation is engaged in a proven solution [cocur/slugify](https://github.com/cocur/slugify).

[![Latest Stable Version](https://camo.githubusercontent.com/f38ce625743ef31e0b9623a84b26c9ed180f058b2b1af08070e361aa2afc1ce5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736b65656b732f796969322d736c75672d6265686176696f722e737667)](https://packagist.org/packages/skeeks/yii2-slug-behavior)[![Total Downloads](https://camo.githubusercontent.com/fcec5aef6ef4311176087e2e3ebaa4d1880523ddfc87036dd5d225d33c714862/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736b65656b732f796969322d736c75672d6265686176696f722e737667)](https://packagist.org/packages/skeeks/yii2-slug-behavior)

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist skeeks/yii2-slug-behavior "*"

```

or add

```
"skeeks/yii2-slug-behavior": "*"

```

How to use
----------

[](#how-to-use)

Attach the behavior in your model:

```
public function behaviors()
{
    return [
        'slug' => [
            'class' => 'skeeks\yii2\slug\SlugBehavior',
            'slugAttribute' => 'slug',                      //The attribute to be generated
            'attribute' => 'name',                          //The attribute from which will be generated
            // optional params
            'maxLength' => 64,                              //Maximum length of attribute slug
            'minLength' => 3,                               //Min length of attribute slug
            'ensureUnique' => true,
            'slugifyOptions' => [
                'lowercase' => true,
                'separator' => '-',
                'trim' => true
                //'regexp' => '/([^A-Za-z0-9]|-)+/',
                //'rulesets' => ['russian'],
                //@see all options https://github.com/cocur/slugify
            ]
        ]
    ];
}
```

Yandex translit :

```
public function behaviors()
{
    return [
        'slug' => [
            'class' => 'skeeks\yii2\slug\SlugBehavior',
            'slugAttribute' => 'slug',                      //The attribute to be generated
            'attribute' => 'name',                          //The attribute from which will be generated
            // optional params
            'slugifyOptions' => [
                'rulesets' => [
                    skeeks\yii2\slug\SlugRuleProvider::YANDEX,
                    'default'
                ]
            ]
        ]
    ];
}
```

Links
-----

[](#links)

- [Github](https://github.com/skeeks-semenov/yii2-slug-behavior)
- [Changelog](https://github.com/skeeks-semenov/yii2-slug-behavior/blob/master/CHANGELOG.md)
- [Issues](https://github.com/skeeks-semenov/yii2-slug-behavior/issues)
- [Packagist](https://packagist.org/packages/skeeks/yii2-slug-behavior)

Demo (view urls)
----------------

[](#demo-view-urls)

-

---

> [![skeeks!](https://camo.githubusercontent.com/e80b006782c0ce0ce23f8e2e2530130e856f2f49c6a5a8e0e15eaf0c87d25d7b/68747470733a2f2f736b65656b732e636f6d2f696d672f6c6f676f2f6c6f676f2d6e6f2d7469746c652d383070782e706e67)](https://skeeks.com)
> *SkeekS CMS (Yii2) — fast, simple, effective!*
> [skeeks.com](https://skeeks.com) | [cms.skeeks.com](https://cms.skeeks.com)

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

3118d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/785306737dd13e3ea6826dfc04ab29ececa88f560d054ff595d64853cb878219?d=identicon)[skeeks-semenov](/maintainers/skeeks-semenov)

---

Top Contributors

[![skeeks-semenov](https://avatars.githubusercontent.com/u/9209305?v=4)](https://github.com/skeeks-semenov "skeeks-semenov (14 commits)")

---

Tags

behaviorskeeksslugsluggableslugifyyiiyii2yii2-behavioryii2-extensionslugyii2Behavioryii

### Embed Badge

![Health badge](/badges/skeeks-yii2-slug-behavior/health.svg)

```
[![Health](https://phpackages.com/badges/skeeks-yii2-slug-behavior/health.svg)](https://phpackages.com/packages/skeeks-yii2-slug-behavior)
```

###  Alternatives

[sjaakp/yii2-sortable-behavior

Sort ActiveRecords and related records in Yii2.

36144.7k](/packages/sjaakp-yii2-sortable-behavior)[sjaakp/yii2-taggable

Manage tags of ActiveRecord in Yii2.

3030.6k](/packages/sjaakp-yii2-taggable)[nanson/yii2-postgis

Yii2-extension to work with postgis data

1851.6k](/packages/nanson-yii2-postgis)[baibaratsky/yii2-serialized-attributes-behavior

Yii2 Serialized Attributes Behavior

1174.1k9](/packages/baibaratsky-yii2-serialized-attributes-behavior)[sjaakp/yii2-illustrated-behavior

ActiveRecord Behavior with associated Widget for Yii2.

423.1k](/packages/sjaakp-yii2-illustrated-behavior)

PHPackages © 2026

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