Download the PHP package paperscissorsandglue/laravel-encryption-at-rest without Composer

On this page you can find all versions of the php package paperscissorsandglue/laravel-encryption-at-rest. 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-encryption-at-rest

Laravel Encryption at Rest

Latest Version on Packagist GitHub Tests Action Status Total Downloads License

A Laravel package for encrypting sensitive data at rest and automatically decrypting it when in use. Useful for regulatory compliance requirements like GDPR, HIPAA, and other data protection standards. Compatible with Laravel 10, 11, and 12.

Features

Requirements

Installation

You can install the package via composer:

After installation, publish the configuration file:

Configuration

In your .env file, you can optionally set a custom encryption key:

If not set, the package will use your application key for encryption.

Basic Usage

Add the Encryptable trait to your model and define which attributes should be encrypted:

That's it! The specified attributes will be automatically encrypted when saved to the database and decrypted when retrieved.

Encrypting JSON Fields

For JSON columns where you only want to encrypt certain fields within the JSON structure, use the EncryptableJson trait:

With this setup, only the specified fields within your JSON structure will be encrypted while the rest of the JSON remains searchable.

Seamless Encryption/Decryption

This package uses smart dynamic getters and setters to handle all encryption and decryption transparently. All encrypted fields, including email, are automatically:

This universal approach means you don't need to write any special code to handle encryption - it just works:

For JSON attributes with encrypted fields, the package also ensures seamless operation:

Encrypted Email Authentication

This package provides special support for encrypting the email field while maintaining the ability to authenticate users by email. This is achieved by adding a searchable hash of the email (email_index) that enables efficient lookup.

Setup Encrypted Email Authentication

  1. First, publish the migration to add the email_index column to your users table:

  2. Add the HasEncryptedEmail trait to your User model:

  3. Update your auth configuration in config/auth.php to use the encrypted email user provider:

  4. For existing users, you'll need to regenerate the email index values and encrypt existing emails. Use the provided command:

Or if you prefer, create a migration:

Querying Users by Email

With the HasEncryptedEmail trait, you can still find users by their email:

How It Works

  1. When a user is created or updated, the email is:

    • Encrypted before storage in the email column
    • A deterministic hash is stored in the email_index column for searching
  2. When a user is retrieved:

    • The email is automatically decrypted
    • Authentication systems use the email_index column for lookups
  3. The authentication provider is modified to:
    • Look up users by the hashed email index
    • Enable all standard Laravel authentication features (login, registration, password reset, etc.)

Manual Encryption/Decryption

You can also use the EncryptionService directly for custom encryption needs:

Using the Facade

You can use the provided facade for quick access to encryption functionality:

CLI Tools

This package includes several command-line tools to help you manage encrypted data.

Encrypting Existing Data

To encrypt data in an existing database table for a model that uses our traits:

Options:

Encrypting Emails Only

For models using the HasEncryptedEmail trait, you can use a dedicated command to process emails:

Options:

Decrypting Data

If you need to decrypt data (for example, when migrating away from encryption):

Options:

⚠️ Warning: Decryption permanently removes the encryption protection from your data. Only use this command when absolutely necessary and after creating a backup.

Security Considerations

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-encryption-at-rest with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/database Version ^10.0|^11.0|^12.0
illuminate/encryption Version ^10.0|^11.0|^12.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 paperscissorsandglue/laravel-encryption-at-rest contains the following files

Loading the files please wait ....