PHPackages                             neo3k/laravel-kms-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. neo3k/laravel-kms-encryption

ActiveLibrary[Security](/categories/security)

neo3k/laravel-kms-encryption
============================

Replace Laravel's built-in encryption with an encryption based on AWS KMS

1.0.0(4y ago)141MITPHPPHP ^8.0

Since May 12Pushed 4y ago1 watchersCompare

[ Source](https://github.com/neo3k/laravel-aws-kms)[ Packagist](https://packagist.org/packages/neo3k/laravel-kms-encryption)[ Docs](https://github.com/neo3k/laravel-aws-kms)[ RSS](/packages/neo3k-laravel-kms-encryption/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Kms Encryption (Laravel 9.x Ready)
==========================================

[](#laravel-kms-encryption-laravel-9x-ready)

Forked from

Introduction
------------

[](#introduction)

This package replaces Laravel's built-in encryption with an encryption based on AWS KMS.

Two major features provided by kms are:

- ability to automatically [rotate key](https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html) (annually) without deleting the previous ones
- you don’t have access to the actual key, which means you can’t leak it

*This package has been based on this [blogpost](https://blog.deleu.dev/swapping-laravel-encryption-with-aws-kms/)*

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

[](#installation)

This package requires Laravel 9.x or higher.

You can install the package via composer:

```
composer require smknstd/laravel-kms-encryption
```

Next you should publish the config file, and setup your values :

```
php artisan vendor:publish --provider="Smknstd\LaravelKmsEncryption\LaravelKmsEncryptionServiceProvider"
```

If you want to use IAM Roles that are already setup, aws sdk will automatically use them by default. Otherwise, you should setup credentials to the proper aws user [allowed](https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-users) to "use" the given kms key, by adding a kms section in your `config/services.php` file :

```
    'kms' => [
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_REGION'),
    ],

```

Now everytime you'll [encrypt](https://laravel.com/docs/8.x/encryption) something it will use the provided kms key. It includes all fields using eloquent's [encrypted casting](https://laravel.com/docs/8.x/eloquent-mutators#encrypted-casting). If you have previously encrypted data, be aware that you won't be able to decrypt it.

### Cookies encryption

[](#cookies-encryption)

If you use laravel's middleware `EncryptCookies`, it can't work with kms. To let the middleware continue working with laravel's encrypter you need to edit `App\Http\kernel.php`. Just replace the existing middleware with :

```
   protected $middlewareGroups = [
     'web' => [
         \Smknstd\LaravelKmsEncryption\Middleware\EncryptCookies::class,
         ...
     ]
   ]

```

Testing
-------

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Arnaud Becher](https://github.com/smknstd)
- [Marco Aurélio Deleu](https://github.com/deleugpn)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

1461d ago

### Community

Maintainers

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

---

Tags

laravelawsencryptionkms

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/neo3k-laravel-kms-encryption/health.svg)

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

###  Alternatives

[spatie/laravel-ciphersweet

Use ciphersweet in your Laravel project

416718.4k1](/packages/spatie-laravel-ciphersweet)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[ercsctt/laravel-file-encryption

Secure file encryption and decryption for Laravel applications

642.6k](/packages/ercsctt-laravel-file-encryption)[mreduar/s3m

Multipart Uploads using Laravel and AWS S3

173.6k](/packages/mreduar-s3m)

PHPackages © 2026

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