skeeks/yii2-ya-slug Yii2 yandex slug

Yii2 yandex slug (Semantic URL) ΒΆ

  1. Installation
  2. How to use
  3. Links
  4. Demo (view urls)

This solution allows you to generate good slug urls. (slug wiki).

Direct generation is engaged in a proven solution cocur/slugify.

Transliteration yandex http://translit-online.ru/yandex.html

Latest Stable Version Total Downloads

Installation ΒΆ

The preferred way to install this extension is through composer.

Either run

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

or add

"skeeks/yii2-ya-slug": "*"

How to use ΒΆ

behavior ΒΆ

Attach the behavior in your model:

public function behaviors()
{
    return [
        'slug' => [
            'class' => 'skeeks\yii2\yaslug\YaSlugBehavior',
            '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,
        ]
    ];
}

helper ΒΆ
echo skeeks\yii2\yaslug\YaSlugBehavior::slugify("ВСстовая строка");

Links ΒΆ

Demo (view urls) ΒΆ

skeeks!
SkeekS CMS (Yii2) β€” fast, simple, effective!
skeeks.com | cms.skeeks.com