PHPackages                             mintopia/laravel-encryptable - 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. mintopia/laravel-encryptable

ActiveLibrary

mintopia/laravel-encryptable
============================

An encryptable trait that can be used in models

v2.0.0(4y ago)0102MITPHPPHP &gt;=8.0

Since Nov 6Pushed 4y agoCompare

[ Source](https://github.com/mintopia/LaravelEncryptable)[ Packagist](https://packagist.org/packages/mintopia/laravel-encryptable)[ RSS](/packages/mintopia-laravel-encryptable/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (4)Versions (9)Used By (0)

Laravel Encryptable Trait
=========================

[](#laravel-encryptable-trait)

Provides a trait to decrypt or encrypt values in a Laravel model.

Usage
-----

[](#usage)

Add the trait to your model, define the `$encrypted` array and fields in it will be encrypted and decrypted on the fly by default.

```
namespace App;

use Cheezykins\LaravelEncryptable\Traits\Encryptable;
use Illuminate\Database\Eloquent\Model;

class MyModel extends Model {
    use Encryptable;

    protected $encrypted = [
        'email'
    ];
}
```

Then in usage:

```
$model = new MyModel();
$model->name = 'Chris';
$model->email = 'chris@test.com';
$model->save();
```

The email field in the database will now be the encrypted value.

`eyJpdiI6IkRZS0lOUlwvR29MbU4zN1diYzl2ZCtnPT0iLCJ2YWx1ZSI6IldEYzVUajlUcDdvVHE0M0kxdForNlE9PSIsIm1hYyI6ImY1MzQ2ZWYwNTNkZDI2YTY2MDgyMmVjZmU3MmI0MGU0NTNmMmU4NWE4OGFmYzZhYTJlYzczMWU1YTdmNzNjYjQifQ==`

When retrieved, the data will be automatically decrypted for you.

```
$model = MyModel::find(1);
echo $model->email;
```

`> "chris@test.com"`

Same for other ways of accessing model data.

```
$model = MyModel::find(1);
return response()->json($model->toArray());
```

```
{
  "id": 1,
  "name": "Chris",
  "email": "chris@test.com"
}
```

**WARNING**

The encrypted value is stored based on your Laravel APP\_KEY using the algorithm defined in your config/app.php cipher setting. If your application key is changed or lost there is **no way** to retrieve the data.

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

[](#installation)

require the project and use it. There is no service provider as it is not needed.

`composer require cheezykins/laravel-encryptable`

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 71.4% 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 ~184 days

Recently: every ~321 days

Total

8

Last Release

1818d ago

Major Versions

v1.2.1 → v2.0.02021-05-16

PHP version history (2 changes)v1.0.0PHP &gt;=7.0

v2.0.0PHP &gt;=8.0

### Community

Maintainers

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

---

Top Contributors

[![chris114782](https://avatars.githubusercontent.com/u/11211889?v=4)](https://github.com/chris114782 "chris114782 (15 commits)")[![mintopia](https://avatars.githubusercontent.com/u/105940?v=4)](https://github.com/mintopia "mintopia (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mintopia-laravel-encryptable/health.svg)

```
[![Health](https://phpackages.com/badges/mintopia-laravel-encryptable/health.svg)](https://phpackages.com/packages/mintopia-laravel-encryptable)
```

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[slowlyo/owl-admin

基于 laravel、amis 开发的后台框架~

61214.2k26](/packages/slowlyo-owl-admin)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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