Looking to hire Laravel developers? Try LaraJobs

laravel-fast-crypt maintained by ibraheem-ghazi

Description
A fast Laravel encryption utility for encrypting and decrypting text with configurable OpenSSL ciphers.
Last update
2026/09/05 10:17 (dev-main)
License
Links
Downloads
0

Comments
comments powered by Disqus

Laravel Fast Crypt

Fast, configurable text encryption for Laravel applications using OpenSSL. It has been used in production to encrypt more than 50,000 entries in less than 2 seconds.

Requirements

  • PHP 8.1 or newer
  • Laravel 9, or newer

Installation

composer require ibraheem-ghazi/laravel-fast-crypt

Laravel discovers the service provider automatically. To publish the package configuration, run:

php artisan vendor:publish --tag=fast-crypt-config

Configuration

Set these environment variables in your application's .env file:

FASTCRYPT_KEY=your-secret-key
FASTCRYPT_CUPHER=aes-256-cbc
FASTCRYPT_SALT_LENGTH=16

Usage

With configuration defaults:

use IbraheemGhazi\FastCrypt\FastCrypter;

$encrypted = FastCrypter::make()->encrypt('private text');
$text = FastCrypter::make()->decrypt($encrypted);

Runtime values can be supplied when needed. Any omitted value comes from the package configuration:

$crypter = FastCrypter::make(
    key: 'another-secret',
    cipher: 'aes-256-cbc',
    saltLength: 24,
);

The package also includes FastEncryptedValue for Eloquent attributes:

use IbraheemGhazi\FastCrypt\Casts\FastEncryptedValue;

protected function casts(): array
{
    return [
        'private_value' => FastEncryptedValue::class,
    ];
}