2017 © Pedro Peláez
 

yii2-extension yii2-slug-behavior

Yii2 slug behavior

image

baibaratsky/yii2-slug-behavior

Yii2 slug behavior

  • Friday, April 17, 2015
  • by baibaratsky
  • Repository
  • 1 Watchers
  • 3 Stars
  • 248 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 2 % Grown

The README.md

Yii2 slug behavior

I’d made this behavior before Yii2 became beta. At the moment, there is no need to use this behavior, because Yii2 has its own implementation — SluggableBehavior., (*1)

This Yii2 model behavior automates the slug generation process. To attach the behavior put the following code in your model:, (*2)

    public function behaviors()
    {
        return [
            'slug' => [
                'class' => Slug::className(),

                // These parameters are optional, default values presented here:
                'sourceAttributeName' => 'name', // If you want to make a slug from another attribute, set it here
                'slugAttributeName' => 'slug', // Name of the attribute containing a slug
                'replacement' => '-', // The replacement to use for spaces in the slug
                'lowercase' => true, // Whether to return the string in lowercase or not
                'unique' => true, // Check if the slug value is unique, add number if not
            ],
        ];
    }

The Versions

17/04 2015

dev-master

9999999-dev http://github.com/baibaratsky/yii2-slug-behavior

Yii2 slug behavior

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

url yii2 yii behavior uri slug