Skip to content

gunter1020/yii2-common

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yii2 Common Lib

PHP Version Require Latest Stable Version Total Downloads License

Installation

composer require gunter1020/yii2-common

or include the dependency in the composer.json file:

{
    "require": {
        "gunter1020/yii2-common": "^1.0"
       
    }
}

Configuration

Optional Use EncryptBehavior

Setting your config file. e.g., /config/web.php

use gunter1020\yii2\common\base\GuSecurity;

$config = [
    'components' => [
        'security' => [
            'class' => GuSecurity::class,
            'encryptKey' => 'YOUR_ENCRYPT_KEY',
        ]
    ]
]

Setting your models file. e.g., /models/Account.php

use gunter1020\yii2\common\behaviors\EncryptBehavior;

public function behaviors()
{
    return [
        'encryptAttrs' => [
            'class' => EncryptBehavior::class,
            'attributes' => ['id_number', 'salary_amount'],
        ],
    ];
}