PHPackages                             wiaamtaleb/laravel-db-encryption - 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. [Security](/categories/security)
4. /
5. wiaamtaleb/laravel-db-encryption

ActiveLibrary[Security](/categories/security)

wiaamtaleb/laravel-db-encryption
================================

1.0.5(3y ago)120MITPHP

Since Jun 2Pushed 3y ago1 watchersCompare

[ Source](https://github.com/wiaamLB/laravel-db-encryption)[ Packagist](https://packagist.org/packages/wiaamtaleb/laravel-db-encryption)[ RSS](/packages/wiaamtaleb-laravel-db-encryption/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (7)Used By (0)

Laravel Encryption Model Package
================================

[](#laravel-encryption-model-package)

[![Total Stars](https://camo.githubusercontent.com/8e5dc233934e61b7b4b54e31d6e342b6c1b87ace89c662b7a98e2df51d787f7e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f776961616d4c422f6c61726176656c2d64622d656e6372797074696f6e3f7374796c653d706c6173746963)](https://github.com/wiaamLB/laravel-db-encryption/stargazers)

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

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

[](#key-features)

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

Requirements
------------

[](#requirements)

- Laravel: 6.0 and up
- PHP: 7.1 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)

Via Composer command line:

```
$ composer require wiaamtaleb/laravel-db-encryption
```

Usage
-----

[](#usage)

1. Use the `wiaamtaleb\LaravelDbEncryption\Traits\Encryptable` 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 wiaamtaleb\LaravelDbEncryption\Traits\Encryptable;

    class User extends Eloquent {
        use Encryptable;

        /** @var array The attributes that should be encrypted/decrypted */
        protected $encryptable = [
            'first_name',
            'last_name',
            '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

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.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 ~0 days

Total

6

Last Release

1440d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a517c1cb4020a62f93ddfb091050f3814c3d55b1f03e8df171bd371f0a7f959a?d=identicon)[wiaamtaleb](/maintainers/wiaamtaleb)

---

Top Contributors

[![wiaamtaleb](https://avatars.githubusercontent.com/u/60391048?v=4)](https://github.com/wiaamtaleb "wiaamtaleb (5 commits)")[![wiaamLB](https://avatars.githubusercontent.com/u/19538693?v=4)](https://github.com/wiaamLB "wiaamLB (1 commits)")

### Embed Badge

![Health badge](/badges/wiaamtaleb-laravel-db-encryption/health.svg)

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

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41278.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[enlightn/security-checker

A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

33732.2M110](/packages/enlightn-security-checker)

PHPackages © 2026

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