Looking to hire Laravel developers? Try LaraJobs
This package is not available.

laravel-encryptable maintained by paulhenri-l

Description
laravel-encryptable
Author
Last update
2021/09/30 00:19 (dev-main)
License
Links
Downloads
161

Comments
comments powered by Disqus

LaravelEncryptable

PHP Tests PHP Code Style License: MIT

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';