2017 © Pedro Peláez
 

library yii_encryption

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

image

maxcrossan/yii_encryption

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

  • Wednesday, May 23, 2018
  • by maxcrossan
  • Repository
  • 1 Watchers
  • 0 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 29 % Grown

The README.md

Encryption Behaviour for Yii

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., (*1)

Installation

Add the following to your composer file and run php composer.phar update, (*2)

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

Configure the Yii securityManger component in protected/config/main.php, (*3)

    '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:, (*4)

    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, (*5)

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, (*6)

The Versions

23/05 2018

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Max Crossan

23/05 2018

1.1

1.1.0.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Max Crossan

22/05 2018

1.0

1.0.0.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Max Crossan