Download the PHP package adityadarma/laravel-database-cryptable without Composer
On this page you can find all versions of the php package adityadarma/laravel-database-cryptable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download adityadarma/laravel-database-cryptable
More information about adityadarma/laravel-database-cryptable
Files in adityadarma/laravel-database-cryptable
Package laravel-database-cryptable
Short Description Cryptable value database for laravel
License MIT
Homepage https://github.com/adityadarma/laravel-database-cryptable
Informations about the package laravel-database-cryptable
Laravel Database Cryptable
Laravel Database Encryption to safety your data.
Laravel Installation Instructions
From your projects root folder in terminal run:
Support
- MYSQL
- MariaDB
- PostgreSQL (required extension pgcrypto)
Usage
Use the CryptableAttribute trait in any Eloquent model that you wish to apply encryption
to and define a protected $encryptable array containing a list of the attributes to encrypt.
For example:
By including the CryptableAttribute trait, the setAttribute(), getAttribute() and getAttributeFromArray()
methods provided by Eloquent are overridden to include an additional step.
Searching Encrypted Fields Example:
Searching encrypted field can be done by calling the whereEncrypted and orWhereEncrypted functions
similar to laravel eloquent where and orWhere. Ordering encrypted data can be calling orderByEncrypted laravel eloquent orderBy.
Encrypt your current data
If you have current data in your database you can encrypt it with the:
php artisan crypt:encrypt User command.
Additionally you can decrypt it using the:
php artisan crypt:decrypt 'User command.
Note: You must implement first the CryptableAttribute trait and set $encryptable attributes
Exists and Unique Validation Rules
If you are using exists and unique rules with encrypted values replace it with exists_encrypted and unique_encrypted
Can I encrypt all my User model data?
Aside from IDs you can encrypt everything you wan't
For example: Logging-in on encrypted email
Credits
This package was inspired from the following:
- austinheap/laravel-database-encryption
- magros/laravel-model-encryption
- DustApplication/laravel-database-model-encryption
- elgiborsolution/laravel-database-encryption
- NdukZ/laravel-database-encryption-pgsql
License
This Package is licensed under the MIT license. Enjoy!