PHPackages                             betterapp/laravel-db-encrypter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. betterapp/laravel-db-encrypter

ActiveLibrary[Database &amp; ORM](/categories/database)

betterapp/laravel-db-encrypter
==============================

Provides database model attribute encryption/decryption

v5.0.0(1y ago)363663.5k↓34.3%47[3 issues](https://github.com/betterapp/laravel-db-encrypter/issues)[1 PRs](https://github.com/betterapp/laravel-db-encrypter/pulls)8MITPHPPHP &gt;=8.2

Since Aug 27Pushed 1y ago11 watchersCompare

[ Source](https://github.com/betterapp/laravel-db-encrypter)[ Packagist](https://packagist.org/packages/betterapp/laravel-db-encrypter)[ RSS](/packages/betterapp-laravel-db-encrypter/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (2)Dependencies (1)Versions (10)Used By (8)

Laravel Db Encrypter Package
============================

[](#laravel-db-encrypter-package)

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

Donnations
----------

[](#donnations)

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

[![](https://camo.githubusercontent.com/f652a90a140e0d7f8ea814604fcb4923d8a8f8e66597e403fcf3d72fc4cd0e2e/68747470733a2f2f692e696d6775722e636f6d2f4b4c547845494c2e706e67)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SPYLWZ8Y5E4JE&source=url)

[https://www.paypal.com/cgi-bin/webscr?cmd=\_s-xclick&amp;hosted\_button\_id=SPYLWZ8Y5E4JE&amp;source=url](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SPYLWZ8Y5E4JE&source=url)

Key features
------------

[](#key-features)

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

Installation
------------

[](#installation)

CommandLaravelcomposer install betterapp/laravel-db-encrypter:^v512composer install betterapp/laravel-db-encrypter:^v411composer install betterapp/laravel-db-encrypter:^v310composer install betterapp/laravel-db-encrypter:^v29composer install betterapp/laravel-db-encrypter:^v16, 7, 8Requirements
------------

[](#requirements)

- Laravel: 12
- PHP: 8.2 and newer

#### Database schema

[](#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:

[](#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
------------

[](#installation-1)

Via Composer command line:

```
$ composer require betterapp/laravel-db-encrypter
```

Usage
-----

[](#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',
        ];
    }
```

3. You can use Laravel's original $casts to cast decrypted values

### License

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity57

Moderate usage in the ecosystem

Community31

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 70.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~207 days

Recently: every ~0 days

Total

9

Last Release

527d ago

Major Versions

v1.0.1 → v2.0.02022-11-21

v1.0.2 → v2.0.12025-03-09

v2.0.1 → v3.0.02025-03-09

v3.0.0 → v4.0.02025-03-09

v3.0.1 → v5.0.02025-03-09

PHP version history (4 changes)v1.0.0PHP &gt;=7.1

v2.0.0PHP &gt;=8.0

v3.0.0PHP &gt;=8.1

v4.0.0PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/5821740a1031d0e5961ca00659826c3caf0142894fd1eacdcbf54115a71d7be4?d=identicon)[betterapp](/maintainers/betterapp)

---

Top Contributors

[![betterapp](https://avatars.githubusercontent.com/u/7449124?v=4)](https://github.com/betterapp "betterapp (26 commits)")[![sweptsquash](https://avatars.githubusercontent.com/u/9886472?v=4)](https://github.com/sweptsquash "sweptsquash (6 commits)")[![niqs87](https://avatars.githubusercontent.com/u/22177309?v=4)](https://github.com/niqs87 "niqs87 (1 commits)")[![safly](https://avatars.githubusercontent.com/u/10373139?v=4)](https://github.com/safly "safly (1 commits)")[![vladkucherov](https://avatars.githubusercontent.com/u/4151984?v=4)](https://github.com/vladkucherov "vladkucherov (1 commits)")[![rytisder](https://avatars.githubusercontent.com/u/17141616?v=4)](https://github.com/rytisder "rytisder (1 commits)")[![moebrowne](https://avatars.githubusercontent.com/u/8448512?v=4)](https://github.com/moebrowne "moebrowne (1 commits)")

---

Tags

laravelencryptiondatabaseeloquentencryptdecryptattributedatabase encryptiondecryptionencrypterdecrypteddatabase encrypterlaravel db encryptionlaravel db encrypterlaravel database encryptionlaravel database encrypterlaravel model encryptionlaravel model encrypterlaravel attribute encrypterlaravel attribute encryption

### Embed Badge

![Health badge](/badges/betterapp-laravel-db-encrypter/health.svg)

```
[![Health](https://phpackages.com/badges/betterapp-laravel-db-encrypter/health.svg)](https://phpackages.com/packages/betterapp-laravel-db-encrypter)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11225.5M36](/packages/anourvalar-eloquent-serialize)[weebly/laravel-mutate

Mutate Laravel attributes

1356.4k](/packages/weebly-laravel-mutate)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
