Provides database model attribute encryption/decryption
rahulshibu/laravel-model-encrypter is a Laravel package for provides database model attribute encryption/decryption.
It currently has 0 GitHub stars and 38 downloads on Packagist.
Install it with composer require rahulshibu/laravel-model-encrypter.
Discover more Laravel packages by rahulshibu
or browse all Laravel packages to compare alternatives.
Last updated
This package was created to encrypt and decrypt values of Eloquent model attributes.
Encrypted values are stored as plain text so in most cases takes up more spaces then unencrypted one.
Recommendation is to alter table column to TEXT type.
If you want use VARCHAR or CHAR column type still you need to check if encrypted value fit.
Do not worry if you have current data in your database not encrypted and added column to $encryptable - they will return as is.
On save values will be encrypted and everything will work fine.
Via Composer command line:
$ composer require rahulshibu/laravel-model-encrypter
LaravelModelEncrypter\Traits\DBEncryptor trait in any Eloquent model that you wish to use encryptionprotected $encryptable array containing a list of the encrypted attributes.For example:
Model
use LaravelModelEncrypter\Traits\DBEncryptor;
class Client extends Eloquent {
use DBEncryptor;
/** @var array The attributes that should be encrypted/decrypted */
protected $encryptable = [
'id_number',
'email',
];
}
ENV
ENCRYPT_KEY=abcd1234
The MIT License (MIT). Please see License File for more information.