yii2x/yii2-common

dev-master 2017-05-14 17:52 UTC

This package is not auto-updated.

Last update: 2024-09-29 03:15:24 UTC


README

YII2 Common

安装

安装此扩展的首选方式是通过 composer

运行以下命令之一:

php composer.phar require --prefer-dist yii2x/yii2-common "*"

或者

"yii2x/yii2-common": "*"

将以下内容添加到您的 composer.json 文件的 require 部分中。

使用方法

一旦安装了扩展,只需在代码中使用它即可

模型配置

    public function behaviors()
    {
        return [           

	    [
                'class' => \yii2x\common\behaviors\IpAddressBlameableBehavior::className(),
                'createdIpAttribute' => 'created_ip',
                'updatedIpAttribute' => 'updated_ip',
            ],                       
            [
                'class' => \yii2x\common\behaviors\JsonFieldBehavior::className(),
                'attributes' => ['params']
            ]
        ];
    }