PHP code example of zelenin / yii2-slug-behavior

1. Go to this page and download the library: Download zelenin/yii2-slug-behavior 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/ */

    

zelenin / yii2-slug-behavior example snippets

 composer.phar 

public function behaviors()
{
    return [
        'slug' => [
            'class' => 'Zelenin\yii\behaviors\Slug',
            'slugAttribute' => 'slug',
            'attribute' => 'name',
            // optional params
            'ensureUnique' => true,
            'replacement' => '-',
            'lowercase' => true,
            'immutable' => false,
            // If intl extension is enabled, see http://userguide.icu-project.org/transforms/general. 
            'transliterateOptions' => 'Russian-Latin/BGN; Any-Latin; Latin-ASCII; NFD; [:Nonspacing Mark:] Remove; NFC;'
        ]
    ];
}

public function behaviors()
{
    return [
        'slug' => [
            ...
            'attribute' => ['name', 'language.username'],
            ...
        ]
    ];
}