seacjs/yii2-slug-behavior

yii2 slug behavior

Installs: 13

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

dev-master 2016-12-16 03:32 UTC

This package is not auto-updated.

Last update: 2024-05-11 17:45:40 UTC


README

Yii2 slug behavior

Installation

Composer

The preferred way to install this extension is through Composer.

Either run php composer.phar require seacjs/yii2-slug-behavior "*"

or add "seacjs/yii2-slug-behavior": "*" to the require section of your composer.json

Using

Attach the behavior in your model:

public function behaviors()
{
    return [
        'slug' => [
            'class' => 'seacjs\behaviors\Slug',
            'slugAttribute' => 'slug',
            'attribute' => 'name',
            'translit' => true,
        ]
    ];
}

or use another class Sluggable, work with transliteration

Sluggable extends SluggableBehavior

public function behaviors()
{
    return [
        'slug' => [
            'class' => 'seacjs\behaviors\Sluggable',
            'slugAttribute' => 'slug',
            'attribute' => 'name',
        ]
    ];
}