New

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

betterapp/laravel-db-encrypter

Provides database model attribute encryption/decryption
733,679 361

Larablocks Analysis

betterapp/laravel-db-encrypter works with Laravel 12 (latest release v5.0.0, Mar 9, 2025).

Laravel 6 to 11 in earlier releases.

Recommendation checks

Use with care

Use with care: meets 2 of 4 checks.

  • Latest release doesn't support Laravel 13, the current version
  • No release in the last 12 months (last: Mar 9, 2025)
  • 21,524 downloads a month (at least 10,000)
  • 361 GitHub stars (at least 100)

State

Quiet
  • Last stable release: Mar 9, 2025.
  • No releases in the last 12 months.
  • First released: Aug 27, 2020.
  • Monthly downloads: 21,524, up 97% from six months ago.
  • 4 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 5, 2026.

Install
composer require betterapp/laravel-db-encrypter
Latest Version:v5.0.0
PHP:>=8.2
Laravel:12
Older releases:6 – 11
License:MIT
Last Updated:Mar 9, 2025
Links: GitHub  ·  Packagist
Maintainer: betterapp

Laravel Db Encrypter Package

This package was created to encrypt and decrypt values of Eloquent model attributes.

Donnations

If You think this package helped You, please donate. Thank You.

https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SPYLWZ8Y5E4JE&source=url

Key features

  • Encrypt, decrypt values stored in database fields
  • Using standard Laravel's Crypt service
  • Easy configuration

Installation

Command Laravel
composer install betterapp/laravel-db-encrypter:^v5 12
composer install betterapp/laravel-db-encrypter:^v4 11
composer install betterapp/laravel-db-encrypter:^v3 10
composer install betterapp/laravel-db-encrypter:^v2 9
composer install betterapp/laravel-db-encrypter:^v1 6, 7, 8

Requirements

  • Laravel: 12
  • PHP: 8.2 and newer
Database schema

Encrypted values are stored as plain text so in most cases takes up more spaces then unencrypted one. Recommendation is to alter table column to TEXT type. If you want use VARCHAR or CHAR column type still you need to check if encrypted value fit.

Note:

Do not worry if you have current data in your database not encrypted and added column to $encryptable - they will return as is.
On save values will be encrypted and everything will work fine.

Installation

Via Composer command line:

$ composer require betterapp/laravel-db-encrypter

Usage

  1. Use the betterapp\LaravelDbEncrypter\Traits\EncryptableDbAttribute trait in any Eloquent model that you wish to use encryption
  2. Define a protected $encryptable array containing a list of the encrypted attributes.

For example:

    
    use betterapp\LaravelDbEncrypter\Traits\EncryptableDbAttribute;

    class Client extends Eloquent {
        use EncryptableDbAttribute;
       
        /** @var array The attributes that should be encrypted/decrypted */
        protected $encryptable = [
            'id_number', 
            'email',
        ];
    }
  1. You can use Laravel's original $casts to cast decrypted values

License

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

Alternatives to betterapp/laravel-db-encrypter

codezero/encrypter

Encrypt and decrypt strings in PHP.

101,773 2
sbamtr/laravel-source-encrypter

Laravel Source Encrypter

52,154 586
tiknil/file-vault
7,719 2
ivinteractive/laravel-rotation

A package to simplify data decryption and re-encryption when the APP_KEY needs r...

5,119 0

Version History

Version Released PHP Laravel License
v5.0.0 >=8.2 ^12.0 MIT
v4.0.0 >=8.2 ^11.0 MIT
v3.0.1 >=8.1 ^10.0 MIT
v3.0.0 >=8.1 ^10.0 MIT
v2.0.1 >=8.0 ^9.0 MIT