New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

taylornetwork/model-encryption

Adds encryption to Laravel models using Laravel's built in encryption
12 1
Install
composer require taylornetwork/model-encryption
Latest Version:1.0.0
PHP:>=5.4.0
Laravel:5
Last Updated:Nov 16, 2016
Links: GitHub  ·  Packagist
Maintainer: samueljtaylor

Model Encryption Trait

This is a trait for Laravel that overrides the default getter and setters to encrypt and decrypt the values using Laravel's builtin encrypt and decrypt functions.

Install

Via Composer

$ composer require taylornetwork/model-encryption

Usage

Include Encryptable trait in any model you want to add encryption and add a $encryptable property with an array of attributes to encrypt/decrypt.


use TaylorNetwork\ModelEncryption\Encryptable;

class DummyModel extends Model
{
    use Encryptable;

    /**
     * Model attributes to encrypt/decrypt
     *
     * @var array
     */
    protected $encryptable = [
        'dummy_attribute'
    ];

    // Code

}

When accessing any property, the Encryptable trait will determine if the attribute is in the $encryptable array, if so, encrypt/decrypt. Otherwise get/set as normal.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

648,266,899 9,701
laravel/framework

The Laravel Framework.

604,216,237 34,982
laravel/tinker

Powerful REPL for the Laravel framework.

512,508,631 7,443
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

429,221,767 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

407,699,310 4,663

Version History

Version Released PHP Laravel License
1.0.0 >=5.4.0 5.3.*