PHPackages                             kablanfatih/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. [Database &amp; ORM](/categories/database)
4. /
5. kablanfatih/encryption

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

kablanfatih/encryption
======================

A package for automatically encrypting and decrypting Eloquent attributes in Laravel , based on configuration settings.

1.1.0(6y ago)029MITPHPPHP &gt;=7.2.0CI failing

Since May 9Pushed 6y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

encryption
==========

[](#encryption)

[![PHP Composer](https://github.com/kablanfatih/encryption/workflows/PHP%20Composer/badge.svg)](https://github.com/kablanfatih/encryption/workflows/PHP%20Composer/badge.svg)[![Packagist Downloads](https://camo.githubusercontent.com/8e12b47f9d14e44cd5f448ab85bcb4976621e0fe6c6feb0b44f691d2ab9ed48e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b61626c616e66617469682f656e6372797074696f6e)](https://packagist.org/packages/kablanfatih/encryption)[![Packagist Version](https://camo.githubusercontent.com/e2a0ffd847c1d1baeba3595305dfa7aea0bbdb6d4f1ae5cd6703f016a677e540/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b61626c616e66617469682f656e6372797074696f6e)](https://packagist.org/packages/kablanfatih/encryption)[![Build Status](https://camo.githubusercontent.com/8a777f4a08d52dcb20ef3d61051c747a2f32ae7ec5b1303839bb6e4df5538c3f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b61626c616e66617469682f656e6372797074696f6e2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/kablanfatih/encryption/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/15670aefceb485a80527b65139ceaae1fd781273fdd87c5e89c974d814dd1646/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b61626c616e66617469682f656e6372797074696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/kablanfatih/encryption/?branch=master)[![Code Intelligence Status](https://camo.githubusercontent.com/4adf8a254df1aa356385884723073030d71bccb3ab807d9ba76fa86e191b9e00/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b61626c616e66617469682f656e6372797074696f6e2f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/code-intelligence)[![Code Coverage](https://camo.githubusercontent.com/a4aeb1271d4c28a7961e1c17d50663dc149ab59863e99467e2ca5fbb3caa6a09/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b61626c616e66617469682f656e6372797074696f6e2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/kablanfatih/encryption/?branch=master)

#### A package for automatically encrypting and decrypting Eloquent attributes in Laravel , based on configuration settings.

[](#a-package-for-automatically-encrypting-and-decrypting-eloquent-attributes-in-laravel--based-on-configuration-settings)

### Installation

[](#installation)

Via Composer command line:

`composer require kablanfatih/encryption`

#### Configure the package

[](#configure-the-package)

simply setting the the DB\_ENCRYPTION\_ENABLED environment variable to true, via the Laravel .env file or hosting environment.

`DB_ENCRYPTION=true`

##### !!! If package not work !!!

[](#-if-package-not-work-)

Via Artisan command line:

`php artisan config:clear`or `php artisan optimize`

### Usage

[](#usage)

Use the Encryptable trait in any Eloquent model that you wish to apply encryption to and define a protected $encrypted array containing a list of the attributes to encrypt.

```
 namespace App\Models;

 use Encryption\src\Encryptable;
 use Illuminate\Database\Eloquent\Model;

 class Question extends Model
 {

     use Encryptable;
     /**
      * The table associated with the model.
      *
      * @var string
      */
     protected $table = 'questions';

     /**
      * The attributes that are mass assignable.
      * @var array
      */
     protected $fillable = [
         'question', 'incorrect1', 'incorrect2', 'incorrect3', 'incorrect4', 'correct'
     ];

     /**
      * The attributes that are encrypted.
      *
      * @var array
      */
     protected $encrypted = [
         'question','answer'
     ];
 }

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

2

Last Release

2190d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/156ef7f8ae74fe58ac1038dec31a248fb1a550497e1a4a2513ddca5022a0cecf?d=identicon)[kablanfatih](/maintainers/kablanfatih)

---

Top Contributors

[![kablanfatih](https://avatars.githubusercontent.com/u/33814925?v=4)](https://github.com/kablanfatih "kablanfatih (24 commits)")

---

Tags

laravelencryptionaesdatabasemodeleloquentencryptdecryptdbattributedatabase encryptiondecryptionlaravel-encryptioneloquent encryptionmodel encryptionattribute encryption

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kablanfatih-encryption/health.svg)

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

###  Alternatives

[betterapp/laravel-db-encrypter

Provides database model attribute encryption/decryption

365614.7k8](/packages/betterapp-laravel-db-encrypter)[delatbabel/elocryptfive

Automatically encrypt and decrypt Eloquent attributes with ease.

8493.0k](/packages/delatbabel-elocryptfive)[dolphiq/laravel-aescrypt

AES encrypt and decrypt Eloquent attributes inspired by elocryptfive

171.7k](/packages/dolphiq-laravel-aescrypt)

PHPackages © 2026

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