paulhenri-l / laravel-encryptable
laravel-encryptable
Installs: 161
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/paulhenri-l/laravel-encryptable
Requires
- php: ^7.3|^8.0
- laravel/framework: ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.1
- orchestra/testbench: ^6.21
- paulhenri-l/php-cs-config: ^1.0
- phpunit/phpunit: ^9.0
- symfony/var-dumper: ^5.3
README
Encrypts your model attributes in the background so that they are encrypted in DB.
Installation
composer require paulhenri-l/laravel-encryptable
Usage
Since encryption makes the values longer think about changing your column type to text.
<?php namespace App\Models; class Person extends Illuminate\Database\Eloquent\Model { use PaulhenriL\LaravelEncryptable\Encryptable; protected $encryptedFields = [ 'lastname', 'email' ]; } $person = new Person([ 'lastname' => 'I will be encrypted', 'email' => 'I will be encrypted too', ]); echo $person->lastname; // output will not be encrypted $person->lastname = 'I will be encryted too';