mazfreelance / yii2-laravel-crypt
yii2-laravel-crypt is yii2 library compatiable with laravel
Installs: 51
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 2
pkg:composer/mazfreelance/yii2-laravel-crypt
Requires
- php: >=5.5
- paragonie/random_compat: 2.0.*
README
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',
],
],
];
}