Search by

ibraheem-ghazi / laravel-fast-crypt

IbraheemAlnabriss

A fast Laravel encryption utility for encrypting and decrypting text with configurable OpenSSL ciphers.

Package info

github.com/ibraheem-ghazi/laravel-fast-crypt

pkg:composer/ibraheem-ghazi/laravel-fast-crypt

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

dev-main 2026-09-05 08:17 UTC

This package is not auto-updated.

Last update: 2026-10-18 07:05:32 UTC


README

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,
    ];
}