定制 maxcrossan/yii_encryption 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

maxcrossan/yii_encryption

Composer 安装命令:

composer require maxcrossan/yii_encryption

包简介

A simple encryption behaviour for encrypting and decrypting database fields on Yii models

README 文档

README

A simple encryption behaviour for encrypting and decrypting database fields on Yii models. After implementation fields configured for encryption will be encrypted the next time the model is saved.

Installation

Add the following to your composer file and run php composer.phar update

    "require": {
        "maxcrossan/yii_encryption": "dev-master"
    },

Configure the Yii securityManger component in protected/config/main.php

    'components'=>array(
        'securityManager'=>array(
            'cryptAlgorithm' => 'rijndael-128',
            'encryptionKey' => 'your-encryption-key'
        )
    )

Usage

Simply add the following to your model behaviours along with the database columns you want to encrypt:

    public function behaviors(){
        return array(
            'EncryptionBehaviour'=>array(
                'class'=>'application.vendor.maxcrossan.yii_encryption.src.EncryptionBehaviour',
                //Add the fields you wish to encrypt below
                'encryptedFields'=>array(
                    'addressLine1',
                    'addressLine2',
                    'lastName',
                    'city',
                    'postcode',
                    'emailAddress',
                    'phone'
                )
            )
        )
    }

Any encrypted database columns are best setup with the BLOB db type

Troubleshooting

If you have problems loading the class inside your models you may need to setup an alias for vendor in main.php, something like Yii::setPathOfAlias('vendor',dirname(__FILE__).'/../../vendor/'); and then reference the EncryptionBehaviour as vendor.maxcrossan.yii_encryption.src.EncryptionBehaviour

统计信息

  • 总下载量: 49
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-05-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固