yii2-laravel-crypt maintained by mazfreelance
Description
yii2-laravel-crypt is yii2 library compatiable with laravel
Author
Last update
2021/12/08 11:32
(dev-master)
License
Downloads
51
Tags
Yii2 Laravel Cryption
this is same as laravel(>=5.1) encrypt and decrypt function.
Changelog
For changes since the last version see the Changelog.
Installation
composer require mazfreelance/yii2-laravel-crypt -W
Config
add your params local
'encrypter' => [
'key' = '',
'cipher' = ''
]
Usage:
1) single use OR
use Cryption\Encrypter;
$cryption = Encrypter("yourRandomString","AES-256-CBC");
$cryption->encrypt("yourData");`
2) this Behavior is used to encrypt data before storing it on the database and to decrypt it upon retrieval.
- add the following code on Model class
public function behaviors()
{
return [
'encryption' => [
'class' => '\Cryption\EncryptionBehavior',
'attributes' => [
'attribute1',
'attribute2',
],
],
];
}