All Projects → yii2mod → yii2-behaviors

yii2mod / yii2-behaviors

Licence: MIT license
Collection of useful behaviors for Yii Framework 2.0

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to yii2-behaviors

yii2-linkable-behavior
Yii2 behavior to help creating urls easier
Stars: ✭ 12 (-52%)
Mutual labels:  yii2, yii2-behaviors, yii2-extension
yii2-translatable
Translatable behavior aggregates logic of linking translations to the primary model
Stars: ✭ 15 (-40%)
Mutual labels:  yii2, yii2-behaviors, yii2-extension
yii2-link-preview
LinkPreview widget render page preview
Stars: ✭ 26 (+4%)
Mutual labels:  yii2, yii2-extension
background-translation-i18n
Based on the YII2 module to translate JSON formatted translation files on the web
Stars: ✭ 11 (-56%)
Mutual labels:  yii2, yii2-extension
yii2-emoji
😄 this is a emoji extension of yii2.
Stars: ✭ 17 (-32%)
Mutual labels:  yii2, yii2-extension
yii2-payment
Yii2 Payment extension hổ trợ tích hợp các cổng thanh toán VnPayment, Onepay, Bảo Kim, Ngân Lượng, VTCPay, MoMo.
Stars: ✭ 20 (-20%)
Mutual labels:  yii2, yii2-extension
yii2-sweet-submit
sweet sumit using sweetalert
Stars: ✭ 26 (+4%)
Mutual labels:  yii2, yii2-extension
yii2-ion-slider
Easily customizable range slider with skins support.
Stars: ✭ 21 (-16%)
Mutual labels:  yii2, yii2-extension
yii2-rollbar
Rollbar for Yii2
Stars: ✭ 36 (+44%)
Mutual labels:  yii2, yii2-extension
ar-variation
Variation behavior for ActiveRecord
Stars: ✭ 46 (+84%)
Mutual labels:  yii2, yii2-extension
yii2-js-urlmanager
That extension provide a way to create urls from your frontend part.
Stars: ✭ 53 (+112%)
Mutual labels:  yii2, yii2-extension
yii2-presenter
Yii2 View Presenter
Stars: ✭ 13 (-48%)
Mutual labels:  yii2, yii2-extension
ar-role
ActiveRecord behavior, which provides relation roles (table inheritance)
Stars: ✭ 34 (+36%)
Mutual labels:  yii2, yii2-extension
yii2-array-query
Yii2 component that allows for searching/filtering the elements of an array.
Stars: ✭ 34 (+36%)
Mutual labels:  yii2, yii2-extension
yii2-timezone
Timezone detector
Stars: ✭ 14 (-44%)
Mutual labels:  yii2, yii2-extension
yii2-vote
Provides voting for any model 👍 👎
Stars: ✭ 70 (+180%)
Mutual labels:  yii2, yii2-extension
yii2-elasticsearch
Elasticsearch client based on official Elasticsearch PHP library
Stars: ✭ 14 (-44%)
Mutual labels:  yii2, yii2-extension
yii2-bankcard-info
银行卡卡号分析(Yii2扩展)
Stars: ✭ 15 (-40%)
Mutual labels:  yii2, yii2-extension
yii2-formbuilder
A drag and drop form builder with jQuery for Yii2
Stars: ✭ 33 (+32%)
Mutual labels:  yii2, yii2-extension
yii2-fileapi-widget
Yii2 FileAPI widget.
Stars: ✭ 51 (+104%)
Mutual labels:  yii2, yii2-extension

Yii2 behaviors

Collection of useful behaviors for Yii Framework 2.0

Latest Stable Version Total Downloads License Build Status

Installation

The preferred way to install this extension is through composer.

Either run

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

or add

"yii2mod/yii2-behaviors": "*"

to the require section of your composer.json file.

Usage

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

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

    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

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].