hgacreative / encryptable
A useful trait for Laravel models to leverage to encrypt/decrypt sensitive data on the fly
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/hgacreative/encryptable
Requires
- php: >=7.0
This package is auto-updated.
Last update: 2025-10-16 06:06:31 UTC
README
This package works with Laravel to allow any model to have encryptable attribues encrypted and decrypted on-the-fly in a very eloquent/Laravel fashion.
We opt to ignore encrypting or decrypting null values when accessing and mutating attributes so that we can use Laravel's $model->whereNull()
and $model->whereNotNull()
query builder methods.
Use the Hgacreative\Encryptable\Encryptable
trait within the relevant models and copy the following code:
/**
* The attributes which should be encrypted in the database
*
* @var array
*/
protected $encryptable = [
//
];