1. Go to this page and download the library: Download tezmanian/utils-crypto library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tezmanian / utils-crypto example snippets
use Tezmanian\Utils\Crypto\AesEncryptionService;
use Tezmanian\Utils\Crypto\AesCipher;
// Generate a 64-character hex key (32 bytes = AES-256)
$hexKey = bin2hex(random_bytes(32));
$service = new AesEncryptionService($hexKey);
$encrypted = $service->encrypt('super-secret-value');
$plaintext = $service->decrypt($encrypted);
new AesEncryptionService(string $hexKey, AesCipher $cipher = AesCipher::Aes256Gcm)
$service->encrypt(string $plaintext): string // returns base64-encoded ciphertext
$service->decrypt(string $encoded): string // returns original plaintext
$service->getCipher(): AesCipher // returns the active cipher variant