New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

samasend/laravel-key-rotate

Rotate your Laravel application key with ease
1,387 8
Install
composer require samasend/laravel-key-rotate
Latest Version:v1.0.0
PHP:^8.2
Laravel:11
License:MIT
Last Updated:Mar 30, 2024
Links: GitHub  ·  Packagist
Maintainer: SamAsEnd

Laravel Key Rotate From Ethiopia

Github Actions Total Downloads Latest Stable Version License

Laravel Key Rotate is a package that extends Laravel's built-in key:generate command, providing a simple and efficient way to rotate your Laravel application's key.

This is particularly useful for maintaining the security and integrity of your application by ensuring that the encryption key is regularly updated.

Prerequisites

  • PHP >= 8.2
  • Laravel >= 11.x

Installation

You can install the package via composer:

composer require samasend/laravel-key-rotate

Usage

To rotate your application key, simply run the following artisan command:

php artisan key:rotate

This command will generate a new application key and update your .env file. The previous key will be stored in the APP_PREVIOUS_KEYS environment variable, allowing for graceful key rotation.

How It Works

The key:rotate command extends Laravel's built-in key:generate command. When run, it generates a new application key as usual. However, instead of simply replacing the old key, it stores the old key in the APP_PREVIOUS_KEYS environment variable. This allows for a smooth transition to the new key, as the old key is still available for decrypting any data that was encrypted with it.

Ideally, this feature should have been implemented in Laravel core, but it's not. So, this package is here to help you.

License

This package is open-sourced software licensed under the MIT license.

Related Packages

lucasviniciusdev/lumen-generate-app-key

Create the application key in Laravel/Lumen Framework with just one command.

859 0
cesargb/laravel-logs-rotate

Rotate files log with compression

69,582 26
hackeresq/laravel-settings

Super simple key/value settings for Laravel 8+

2,195 31
tecactus/keycdn

Laravel KeyCDN package

161 1
pearl/lumen-log-rotate

Rotating log file in the Lumen framework

144 0

Version History

Version Released PHP Laravel License
v1.0.0 ^8.2 ^11.0 MIT
v0.1.0 ^8.2 ^11.0 MIT