Skip to content

seacjs/yii2-slug-behavior

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Yii2 slug behavior

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',
        ]
    ];
}

About

Slug behavior extension for Yii2 framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages