2017 © Pedro Peláez
 

yii2-extension yii2-behaviors

Collection of useful behaviors for Yii Framework 2.0

image

yii2mod/yii2-behaviors

Collection of useful behaviors for Yii Framework 2.0

  • Monday, December 12, 2016
  • by disem
  • Repository
  • 4 Watchers
  • 16 Stars
  • 17,395 Installations
  • PHP
  • 6 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 11 % Grown

The README.md

Yii2 behaviors

Collection of useful behaviors for Yii Framework 2.0, (*1)

Latest Stable Version Total Downloads License Build Status, (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

php composer.phar require --prefer-dist yii2mod/yii2-behaviors "*"

or add, (*5)

"yii2mod/yii2-behaviors": "*"

to the require section of your composer.json file., (*6)

Usage

1) PurifyBehavior, (*7)

    public function behaviors()
    {
        return [
            'purify' => [
                'class' => PurifyBehavior::className(),
                'attributes' => ['title', 'content'],
                'config' => [
                    'AutoFormat.Linkify' => true,
                    'HTML.TargetBlank' => true,
                    'HTML.Nofollow' => true
                ]
            ]
        ];
    }

2) CarbonBehavior, (*8)

CarbonBehavior automatically creates a Carbon Instance for one or multiple attributes of an ActiveRecord object when afterFind event happen., (*9)

    public function behaviors()
    {
            return [
                'carbon' => [
                    'class' => CarbonBehavior::className(),
                    'attributes' => [
                        'createdAt',
                        'trialEndAt',
                    ]
                ],
            ];
     }

      $user = UserModel::findOne(1);

      var_dump($user->createdAt->year); // 2016
      var_dump($user->createdAt->month); // 5
      var_dump($user->createdAt->day); // 10

      // change date

      $user->trialEndAt->addYear();
      $user->save();

Carbon Documentation, (*10)

Support us

Does your business depend on our contributions? Reach out and support us on Patreon. All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff., (*11)

The Versions

12/12 2016

dev-master

9999999-dev

Collection of useful behaviors for Yii Framework 2.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Igor Chepurnoy

yii2 yii2 behaviors

22/11 2016

1.2

1.2.0.0

Collection of useful behaviors for Yii Framework 2.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Igor Chepurnoy

yii2 yii2 behaviors

05/07 2016

1.1

1.1.0.0

Yii2 behaviors

  Sources   Download

MIT

The Requires

 

by Igor Chepurnoy

extension yii2

10/05 2016

1.0.1

1.0.1.0

Yii2 behaviors

  Sources   Download

MIT

The Requires

 

by Igor Chepurnoy

extension yii2

24/06 2015

1.0

1.0.0.0

Yii2 Enumerable helpers

  Sources   Download

MIT

by Igor Chepurnoy

extension yii2