A simple trait to make attributes encrypted in the database
49,190
20
2
Package Data
Maintainer Username: gregoryduckworth
Maintainer Contact: gregoryduckworth@googlemail.com (Greg Duckworth)
Package Create Date: 2016-10-20
Package Last Update: 2020-02-14
Language: PHP
License: MIT
Last Refreshed: 2024-03-26 03:04:07
Package Statistics
Total Downloads: 49,190
Monthly Downloads: 141
Daily Downloads: 4
Total Stars: 20
Total Watchers: 2
Total Forks: 2
Total Open Issues: 2

Encryptable, an ecryptable trait for Laravel

Encryptable is a trait for Laravel that adds simple encryptable functions to Eloquent Models.

Encryptable allows you to encrypt data as in enters the database and decrypts it on its retrieval.

Installation

Simple add the package to your composer.json file and run composer update.

"gregoryduckworth/encryptable": "1.*",

Usage

Add the trait to your model and your encryptable rules.

use GregoryDuckworth\Encryptable\EncryptableTrait;

class User extends Authenticatable
{
	use EncryptableTrait;

	/**
	 * Encryptable Rules
	 *
	 * @var array
	 */
	protected $encryptable = [
		'name',
		'email',
	];
	
...
}

Now, whenever you interact with the model, the name and email will automatically be encrypted and decrypted between your frontend and the database.

Contributing

Anyone is welcome to contribute. Fork, make your changes and then submit a pull request.