orz14 / crypt-php
Simple AES-256-CBC encryption and decryption class for PHP.
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/orz14/crypt-php
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.