alexs / yii2-sluggable
Sluggable behavior for Yii2 Framework.
1.1.2-stable
2017-09-17 06:36 UTC
Requires
- php: >=5.4.0
- yiisoft/yii2: >=2.0.6
Requires (Dev)
- php: >=7.0.0
- alexs/yii2-phpunittestcase: *
- phpunit/phpunit: ^6.2
This package is auto-updated.
Last update: 2024-10-25 13:21:53 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
],
// ...
];
}