seacjs / yii2-slug-behavior
yii2 slug behavior
Package info
github.com/seacjs/yii2-slug-behavior
Type:yii2-extension
pkg:composer/seacjs/yii2-slug-behavior
dev-master
2016-12-16 03:32 UTC
Requires
This package is not auto-updated.
Last update: 2026-03-15 04:18:07 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', ] ]; }