PHPackages                             ivinteractive/laravel-rotation - 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. ivinteractive/laravel-rotation

ActiveLibrary[Security](/categories/security)

ivinteractive/laravel-rotation
==============================

A package to simplify data decryption and re-encryption when the APP\_KEY needs rotation.

v1.1.0(1y ago)03.3k↓100%MITPHPPHP ^8.1CI passing

Since Feb 7Pushed 1y ago2 watchersCompare

[ Source](https://github.com/ivinteractive/laravel-rotation)[ Packagist](https://packagist.org/packages/ivinteractive/laravel-rotation)[ Docs](https://github.com/ivinteractive/laravel-rotation)[ RSS](/packages/ivinteractive-laravel-rotation/feed)WikiDiscussions main Synced today

READMEChangelog (9)Dependencies (9)Versions (10)Used By (0)

Rotater for Laravel
===================

[](#rotater-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2dba62eeaa84162d1469cf543913da7d6a406c0edaa18b2062f38cd0fa70dbaa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6976696e7465726163746976652f6c61726176656c2d726f746174696f6e2e737667)](https://packagist.org/packages/ivinteractive/laravel-rotation)[![Total Downloads](https://camo.githubusercontent.com/fe7a5d3d7192f215c1e55d3cb25a2210a59bed9eff56944b6d12957005131df0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6976696e7465726163746976652f6c61726176656c2d726f746174696f6e2e737667)](https://packagist.org/packages/ivinteractive/laravel-rotation)[![Tests Workflow](https://github.com/ivinteractive/laravel-rotation/actions/workflows/tests.yml/badge.svg)](https://github.com/ivinteractive/laravel-rotation/actions/workflows/tests.yml/badge.svg)[![PHPStan Workflow](https://github.com/ivinteractive/laravel-rotation/actions/workflows/phpstan.yml/badge.svg)](https://github.com/ivinteractive/laravel-rotation/actions/workflows/phpstan.yml/badge.svg)[![License](https://camo.githubusercontent.com/9c486a4c4406808a7a2072f20d861a4c3e680532e98e23bfb88f20946a248bea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6976696e7465726163746976652f6c61726176656c2d726f746174696f6e)](https://camo.githubusercontent.com/9c486a4c4406808a7a2072f20d861a4c3e680532e98e23bfb88f20946a248bea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6976696e7465726163746976652f6c61726176656c2d726f746174696f6e)

Rotater for Laravel is a package for reencrypting your data in case your application's encryption key becomes compromised. By running `php artisan rotation:run`, the package will generate a new application key and reencrypt all configured database columns using the the new key.

### Why choose this package?

[](#why-choose-this-package)

While there are other key rotation packages available and you can also implement key rotation functionality manually, there are a number of features that will help key rotation run smoothly:

- Rotater pushes reencryption to the queue. With Laravel Horizon or multiple queue workers, this allows the reencryption processing to complete much more quickly than running everything synchronously. Since jobs are batched, you will still know when reencryption is done.
- Support for changing the cipher. Some older applications may still be using a shorter application key, but Rotater allows you to specify old and new ciphers so that the key can be updated.
- Rotater runs directly on the database columns specified in the config file. It does not interact with models, which improves performance, and makes for a more drop-in solution. While you can write your own command or implementation of the `RotatesApplicationKey` interface, there's no requirement to do so and there's no need to make your models implement an interface or use a trait. If you'd like, you could even create a separate application for handling the reencryption process so it doesn't need to touch your existing codebase at all.
- Quality of life improvements: support for sending a notification when reencryption finishes, and automatically turning maintenance mode on and off.

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

[](#installation)

You can install the package via composer:

```
composer require ivinteractive/laravel-rotation
```

Publish the configuration file:

```
php artisan vendor:publish --tag=rotation.config
```

The configuration file will contain the following:

```
