shaggyrec / php-encrypt-decrypt
Simple PHP encryptor-decryptor
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/shaggyrec/php-encrypt-decrypt
Requires
- ext-openssl: *
Requires (Dev)
- phpunit/phpunit: ^7.5
This package is auto-updated.
Last update: 2025-09-15 20:14:50 UTC
README
Simple PHP encryptor-decryptor using openssl
Install
composer require shaggyrec/php-encrypt-decrypt
Usage
$phpEncryptorDecryptor = new PhpEncryptorDecryptor('secretKey', 'secretIv');
- Params
- secretKey - should have been previously generated in a cryptographically safe way, like openssl_random_pseudo_bytes
- secretIv - should have been generated n a cryptographically safe way, like openssl_random_pseudo_bytes
- Returns
- object PhpEncryptDecrypt\PhpEncryptorDecryptor
Encryptor
$phpEncryptorDecryptor->encrypt('string);
- Params
- encoding string
- Returns
- base64 encoded string hash
Decryptor
$phpEncryptorDecryptor->decrypt('encrypted string);
- Params
- decoding base64 hash string
- Returns
- Decoded string
- false if decoding was fail