Download the PHP package henzeb/laravel-encrypted-data-rotator without Composer

On this page you can find all versions of the php package henzeb/laravel-encrypted-data-rotator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-encrypted-data-rotator

Encrypted data rotator for Laravel 11+

Build Status Latest Version on Packagist Total Downloads License

Laravel 11 comes with app key rotation. Sadly, at this point, laravel won't re-encrypt the data unless a user changes it.

This package allows you to rotate Models by default, but also allows you to rotate your own custom encrypted data.

Installation

Just install with the following command.

Usage

Configuring

You do not need to modify anything when you are just going to rotate the Models. Everything is done automatically for you. Most is configurable by environment variables.

Publishing the configuration

The configuration file is published with the following command:

Rotate the key

Laravel does not come with a handy key rotate command, you need to manually save the key in the APP_PREVIOUS_KEYS variable, which you might forget, or simply make mistakes with.

You can also select a different environment.

On production, you are being asked if you want to rotate the keys. you can force this.

Rotate your data

When you have rotated the key, the encrypted data hasn't changed yet. Laravel will use the previous keys if the current one cannot decrypt the data. Using the following the data will also be rotated.

You do not have to do anything on the Models. The Models and their encrypted attributes are automatically detected.

Note: just like the key rotation command, key:rotate-data accepts env to specify an environment and force to start rotation without confirmation.

Rotating mutators

If you have mutators in your model that handles encrypted data, you want them to be rotated as well. For those situations you can use the Attribute EncryptsData. The key:rotate-data command will then detect the mutator and rotate its data.

``

Rotating custom attribute casts

It is possible to rotate custom casts. Your CastsAttributes implementation should either have encrypted in its class name, or implement the Henzeb\Rotator\Contracts\CastsEncryptedAttributes interface.

Note: This also works with CastsInboundAttributes implementations

rotating custom encrypted data

To rotate encrypted data that is not accessible by models, you can implement the rotateEncryptedData method on the \Henzeb\Rotator\Contracts\RotatesEncryptedData interface. When the default configuration is applied, these implementations are also automatically detected.

customize rotation on Models

The RotatesEncryptedData interface can also be applied on Models. These are per-record basis.

Events

For each processed Model, a ModelEncryptionRotated event is emitted. It contains the Model for easy access.

Note: For custom implementations, there are no events. You have to implement them yourself.

Queue

Everything is done utilizing the queue. By default it uses the default queue and default connection. You can change that by setting the ROTATOR_QUEUE and ROTATOR_QUEUE_CONNECTION, or the corresponding keys in the configuration file.

To avoid out of memory, the amount of jobs in the given queue is limited by the ROTATOR_JOB_LIMIT. Whenever the queue size is too big, the RotateModelsWithEncryptedData job will be placed back on the queue waiting for the jobs it had dispatched to finish. This is by default 100 jobs.

To avoid heavy load on your database, you can modify the ROTATOR_CHUNK_SIZE. By default, 50 records are pulled from your database and dispatched to the queue.

Cleaning up previous keys

if you rotate regularly, or when you are confident the keys are no longer needed, you can cleanup the keys simply by running the following command:

Note: just like the other commands, key:cleanup-previous-keys accepts env to specify an environment and force to clean up without confirmation.

Testing this package

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The GNU AGPLv. Please see License File for more information.


All versions of laravel-encrypted-data-rotator with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
haydenpierce/class-finder Version ^0.5.3
illuminate/support Version ^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package henzeb/laravel-encrypted-data-rotator contains the following files

Loading the files please wait ....