rocket-php-lab/yii2-bridge-slug

Slug behavior for Bridge

Installs: 278

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

Type:yii2-extension

v0.0.1 2020-02-12 07:27 UTC

This package is auto-updated.

Last update: 2024-03-19 16:01:45 UTC


README

Yii2 bridge slug behavior

This code is inspired by https://github.com/zelenin/yii2-slug-behavior, with correction of errors related to the Kazakh language. Full documentation about this behavior, you can read on the above repository.

Installation

Composer

The preferred way to install this extension is through Composer.

Either run `composer require yii2-bridge/slug-behavior:^0.1`

or add `"yii2-bridge/slug-behavior": "^0.1"to the require section of yourcomposer.json`

Using

Attach the behavior in your model:

public function behaviors()
{
    return [
        'slug' => [
            'class' => 'Bridge\Slug\BridgeSlugBehavior',
            'slugAttribute' => 'slug',
            'attribute' => 'title',
            // 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;'
        ],
    ];
}

Author

Altynbek Kazezov, e-mail: altinbek__97@mail.ru