Provides database model attribute encryption/decryption
betterapp/laravel-db-encrypter is a Laravel package for provides database model attribute encryption/decryption.
It currently has 364 GitHub stars and 646.835 downloads on Packagist (latest version v5.0.0).
Install it with composer require betterapp/laravel-db-encrypter.
Discover more Laravel packages by betterapp
or browse all Laravel packages to compare alternatives.
Last updated
This package was created to encrypt and decrypt values of Eloquent model attributes.
If You think this package helped You, please donate. Thank You.
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SPYLWZ8Y5E4JE&source=url
| Command | Laravel | |-----------------------------------------------------|---------| | composer install betterapp/laravel-db-encrypter:^v5 | 12 | | composer install betterapp/laravel-db-encrypter:^v4 | 11 | | composer install betterapp/laravel-db-encrypter:^v3 | 10 | | composer install betterapp/laravel-db-encrypter:^v2 | 9 | | composer install betterapp/laravel-db-encrypter:^v1 | 6, 7, 8 |
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 betterapp/laravel-db-encrypter
betterapp\LaravelDbEncrypter\Traits\EncryptableDbAttribute trait in any Eloquent model that you wish to use encryptionprotected $encryptable array containing a list of the encrypted attributes.For example:
use betterapp\LaravelDbEncrypter\Traits\EncryptableDbAttribute;
class Client extends Eloquent {
use EncryptableDbAttribute;
/** @var array The attributes that should be encrypted/decrypted */
protected $encryptable = [
'id_number',
'email',
];
}
The MIT License (MIT). Please see License File for more information.