Download the PHP package waseem/laravel-data-encryption without Composer
On this page you can find all versions of the php package waseem/laravel-data-encryption. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download waseem/laravel-data-encryption
More information about waseem/laravel-data-encryption
Files in waseem/laravel-data-encryption
Package laravel-data-encryption
Short Description Automatically encryption and decryption data overriding by using getAttribute an setAttribute methods of Eloquent Model.
License MIT
Informations about the package laravel-data-encryption
laravel-data-encryption
A trait to encrypt data models in Laravel, this automatically encrypt and decrypt model data overriding getAttribute an setAttribute methods of Eloquent Model.
How to install
Run composer installation
Add ServiceProvider to your app/config.php file
Publish configuration file, this will create config/encrypt.php
How to use
-
You must add
SECRET_ENCRYPT_KEY
andENCRYPT_PREFIX
in your .env file or set it in yourconfig/encrypt.php
file -
Use the
Waseem\Encipher\Encipher
trait: -
Set the
$encipher
array on your Model. -
Here's a complete example:
-
Optional. Encryption your current data
if your lavarel application version 5.8+
If you have current data in your database you can encrypt it with the:
php artisan encipher:encryptionModel 'App\Models\User'
command.Additionally you can decrypt it using the:
php artisan encipher:decryptionModel 'App\Models\User'
command.Note: You must implement first the
Encipher
trait and set$encipher
attributes -
If you are using exists and unique rules with encrypted values replace it with exists_encrypted and unique_encrypted
OR
-
You can still use
where
functionsAutomatically
[email protected]
will be encrypted and pass it to the query builder.