alexs/yii2-sluggable

Sluggable behavior for Yii2 Framework.

Installs: 108

Dependents: 0

Suggesters: 0

Security: 0

Type:yii2-extension

1.1.2-stable 2017-09-17 06:36 UTC

README

Sluggabble extension for Yii2

<?php
namespace app\models;
use alexs\yii2sluggable\Sluggable;
use yii\db\ActiveRecord;

class Article extends ActiveRecord
{
    // ...
    public function behaviors() {
        return [
            [
                'class'=>Sluggable::className(),
                'attribute_from'=>'title', // optional
                'attribute_slug'=>'slug',  // optional
            ],
            // ...
        ];
    }
<?php
namespace app\models;
use alexs\yii2sluggable\TransliterateRussianSluggable;
use yii\db\ActiveRecord;

class Article extends ActiveRecord
{
    // ...
    public function behaviors() {
        return [
            [
                'class'=>TransliterateRussianSluggable::className(),
                'attribute_from'=>'title', // optional
                'attribute_slug'=>'slug',  // optional
            ],
            // ...
        ];
    }