PHP code example of skeeks / yii2-ya-slug
1. Go to this page and download the library: Download skeeks/yii2-ya-slug library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
skeeks / yii2-ya-slug example snippets
public function behaviors()
{
return [
'slug' => [
'class' => 'skeeks\yii2\yaslug\YaSlugBehavior',
'slugAttribute' => 'slug', //The attribute to be generated
'attribute' => 'name', //The attribute from which will be generated
// optional params
'maxLength' => 64, //Maximum length of attribute slug
'minLength' => 3, //Min length of attribute slug
'ensureUnique' => true,
]
];
}
echo skeeks\yii2\yaslug\YaSlugBehavior::slugify("Тестовая строка");
php composer.phar