New

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

venturedrake/laravel-encryptable

Automatically encrypt and decrypt database table fields
13,099 3
Install
composer require venturedrake/laravel-encryptable
Latest Version:0.1.6
PHP:^7.2|^8.0
Laravel:6 – 12
License:MIT
Last Updated:Apr 14, 2026
Links: GitHub  ·  Packagist
Maintainer: andrewdrake

Laravel Encryptable

Latest Version on Packagist Build Status Codacy Badge Total Downloads

Automatically encrypt and decrypt database table fields.

Installation

You can install the package via composer:

composer require venturedrake/laravel-encryptable

You can publish the config file with:

php artisan vendor:publish --provider="VentureDrake\LaravelEncryptable\LaravelEncryptableServiceProvider" --tag="config"

Usage

Add the trait to your model and your encryptable rules.

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use VentureDrake\LaravelEncryptable\Traits\LaravelEncryptableTrait;

class Person extends Model
{
    use LaravelEncryptableTrait;
    
    /**
	 * Laravel Encryptable Rules
	 *
	 * @var array
	 */
    protected $encryptable = [
        'first_name',
        'last_name',
    ];
    
...  
}

Now when you store, update or read from the model the first_name and last_name fields will automatically be encrypted and decrypted.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

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

Version History

Version Released PHP Laravel License
0.1.6 ^7.2|^8.0 ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0 MIT
0.1.5 ^7.2|^8.0 ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0 MIT
0.1.4 ^7.2|^8.0 ^6.0|^7.0|^8.0|^9.0|^10.0 MIT
0.1.3 ^7.2|^8.0 ^6.0|^7.0|^8.0|^9.0|^10.0 MIT
0.1.2 ^7.2|^8.0 ^6.0|^7.0|^8.0|^9.0 MIT