PHPackages                             flexflux/encryptor - 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. flexflux/encryptor

ActiveLibrary[Security](/categories/security)

flexflux/encryptor
==================

Package to automatically encrypt and decrypt model attributes in your Laravel project.

3.0.1(3y ago)0278MITPHP

Since May 23Pushed 3y ago1 watchersCompare

[ Source](https://github.com/wouterdeberg/encryptor)[ Packagist](https://packagist.org/packages/flexflux/encryptor)[ RSS](/packages/flexflux-encryptor/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

FlexFlux - Laravel Encryptor
============================

[](#flexflux---laravel-encryptor)

Encryptor is a simple package to automatically encrypt and decrypt attributes from your models. Encryptor creates an extra layer of security for your applications data. The encrypted data won't be readable on database level.

Requires
--------

[](#requires)

Laravel version 8.12 or higher.

### Installation

[](#installation)

- Step 1: Install package via composer.

```
composer require flexflux/encryptor
```

- Step 2: Add the EncryptorServiceProvider to your providers list in `config/app.php`.

```
\FlexFlux\Encryptor\EncryptorServiceProvider::class,

```

- Step 3: Add the Encryptable trait to your models you want to encrypt.

```
use FlexFlux\Encryptor\Encryptable;
use Encryptable;

```

- Step 4: Define which attributes you want to encrypt by adding them to your encryptable array inside the model.

```
protected $encryptable = [
        'name'
    ];

```

- Step 5: Make sure the attributes have the data type `text` inside your database. The encrypted data stored in the attribute can be longer then 255 characters.

#### PLEASE DO NOT encrypt passwords or e-mailaddresses used for authentication. The authentication won't work if you do this.

[](#please-do-not-encrypt-passwords-or-e-mailaddresses-used-for-authentication-the-authentication-wont-work-if-you-do-this)

### Encrypt your production database

[](#encrypt-your-production-database)

#### Requirements:

[](#requirements)

- All your models needs to be inside the `app\Models` folder of your Laravel project.
- You did all the installation steps above.
- You changed the data type of your encryptable attributes to text without compromising data.

#### To use Encryptor on an application already deployed to production we need to do the following steps on your production application:

[](#to-use-encryptor-on-an-application-already-deployed-to-production-we-need-to-do-the-following-steps-on-your-production-application)

- Step 0: Make sure you've made a backup of your database to restore in case anything goes wrong. Make sure you backup your APP\_KEY in your `.env` file too.
- Step 1: First, make sure your application is not used by entering the following command inside your project folder: `php artisan down`. This will put your application offline for your users.
- Step 2: Remove (or comment) the Encryptable trait `use Encryptable;` in each model you added this to. Add the `FlexFlux\Encryptor\EncryptThis` trait from Encryptor instead by adding `use EncryptThis`. Make sure you still have the `protected $encryptable = []` array inside your model with the attributes you want to encrypt. We're going to use this variable. (You can also do this in a commit and push it to your production server or something like that)
- Step 3: Next, we run the following command: `php artisan encryptor:encrypt` inside your project folder. The command should now run through your Laravel models and encrypt each attribute on every row you wanted to encrypt.
- Step 4: Enable the `Encryptable` trait again on every model and remove the `EncryptThis` trait. (You can also do this in a commit and push it to your production server or something like that)
- Step 5: Put your application back online by entering the following command: `php artisan up` and your good to go! Your old and new database records are now encrypted at rest.

### Work in progress

[](#work-in-progress)

- I'm planning to make it possible to search on encrypted attributes.

### DISCLAIMER

[](#disclaimer)

Please backup your APP\_KEY from your production environment file. This key is used to encrypt and decrypt your data. Once you lost it, the data can never be decrypted.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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 ~180 days

Total

5

Last Release

1134d ago

Major Versions

0.0.1 → 1.0.02021-09-29

1.0.1 → 3.0.02023-03-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/4ebfed81156fa6253277d64a6432f45c455f29ace57298c5001b2d436d0b24a9?d=identicon)[flux](/maintainers/flux)

---

Top Contributors

[![wouterdeberg](https://avatars.githubusercontent.com/u/19665914?v=4)](https://github.com/wouterdeberg "wouterdeberg (5 commits)")

---

Tags

laravelsecurityencryptiondecryptionencrypterflexfluxencryptor

### Embed Badge

![Health badge](/badges/flexflux-encryptor/health.svg)

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

###  Alternatives

[sbamtr/laravel-source-encrypter

Laravel Source Encrypter

58747.8k](/packages/sbamtr-laravel-source-encrypter)[akaunting/laravel-firewall

Web Application Firewall (WAF) package for Laravel

1.0k494.9k2](/packages/akaunting-laravel-firewall)[al-saloul/encryption

Simple number encryption and decryption package

181.4k](/packages/al-saloul-encryption)

PHPackages © 2026

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