PHPackages                             chr15k/laravel-mysql-encrypt - 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. chr15k/laravel-mysql-encrypt

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

chr15k/laravel-mysql-encrypt
============================

Laravel database encryption using native MySQL functions

2.2.1(1y ago)1110.2k↓32.1%12MITPHPPHP ^8.0

Since Dec 30Pushed 1y ago1 watchersCompare

[ Source](https://github.com/chr15k/laravel-mysql-encrypt)[ Packagist](https://packagist.org/packages/chr15k/laravel-mysql-encrypt)[ RSS](/packages/chr15k-laravel-mysql-encrypt/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (6)Versions (22)Used By (0)

Laravel MySql AES Encrypt/Decrypt
=================================

[](#laravel-mysql-aes-encryptdecrypt)

[![Latest Stable Version](https://camo.githubusercontent.com/427dc64a052c3b3fa8c9bd2ef9d0c89c31d5215fa84b0434eb4055c60e3b8f40/68747470733a2f2f706f7365722e707567782e6f72672f63687231356b2f6c61726176656c2d6d7973716c2d656e63727970742f76)](https://packagist.org/packages/chr15k/laravel-mysql-encrypt) [![Total Downloads](https://camo.githubusercontent.com/a3b87c9374a144fe0d5af1c77cc037361a3abf70a7970e52a4721d14d55e9097/68747470733a2f2f706f7365722e707567782e6f72672f63687231356b2f6c61726176656c2d6d7973716c2d656e63727970742f646f776e6c6f616473)](https://packagist.org/packages/chr15k/laravel-mysql-encrypt) [![Latest Unstable Version](https://camo.githubusercontent.com/15dda9d3a1ce26b77263d04dadbae2d159c74bbec77d7369beb6d91a9cdc0f99/68747470733a2f2f706f7365722e707567782e6f72672f63687231356b2f6c61726176656c2d6d7973716c2d656e63727970742f762f756e737461626c65)](https://packagist.org/packages/chr15k/laravel-mysql-encrypt) [![License](https://camo.githubusercontent.com/1b736c5537f04c179b1adb7ab41cdd9ce52871269fcf8d3a1c552228f3137139/68747470733a2f2f706f7365722e707567782e6f72672f63687231356b2f6c61726176656c2d6d7973716c2d656e63727970742f6c6963656e7365)](https://packagist.org/packages/chr15k/laravel-mysql-encrypt) [![PHP Version Require](https://camo.githubusercontent.com/249f383e5a9d735419dd0297f9dca5a2fccbfb57d656e58b92d198d74fa0c47d/68747470733a2f2f706f7365722e707567782e6f72672f63687231356b2f6c61726176656c2d6d7973716c2d656e63727970742f726571756972652f706870)](https://packagist.org/packages/chr15k/laravel-mysql-encrypt)

Laravel MySQL encryption using native MySQL AES\_DECRYPT and AES\_ENCRYPT functions. Automatically encrypt and decrypt fields in your Models.

Install
-------

[](#install)

### 1. Composer

[](#1-composer)

```
composer require chr15k/laravel-mysql-encrypt
```

### 2. Publish config

[](#2-publish-config)

```
php artisan vendor:publish --provider="Chr15k\MysqlEncrypt\Providers\MysqlEncryptServiceProvider"
```

### 3. AES Key generation

[](#3-aes-key-generation)

Add to .env file:

```
APP_AESENCRYPT_KEY=

```

Generate a new secure AES key (or add your existing key manually):

```
php artisan laravel-mysql-encrypt:key:generate
```

Update Models
-------------

[](#update-models)

```
