orz14 / crypt-php
Simple AES-256-CBC encryption and decryption class for PHP.
v1.0.0
2025-10-06 13:17 UTC
Requires
- php: >=7.4
Requires (Dev)
- phpunit/phpunit: ^9.6
README
Simple AES-256-CBC encryption and decryption class for PHP.
Installation
You can install the package via Composer.
composer require orz14/crypt-php
Usage
Make sure the CROSS_ENCRYPTION_KEY environment variable is set and contains a base64-encoded key (32 bytes before encoding).
# generate key example php -r "echo base64_encode(random_bytes(32)) . PHP_EOL;"
use Orz14\Crypt; // Encryption $cipher = Crypt::encrypt('hello world'); echo $cipher; // D5kvEf5S4MAKdLNcTbZdWkMGmI34vQt+LOdP4iU7C+w= // Decryption $plain = Crypt::decrypt($cipher); echo $plain; // hello world
Changelog
Please see the GitHub "Releases" page for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.