1. Go to this page and download the library: Download initphp/encryption 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/ */
initphp / encryption example snippets
nitPHP\Encryption\Encrypt;
use InitPHP\Encryption\OpenSSL;
$handler = Encrypt::use(OpenSSL::class, [
'key' => getenv('APP_ENCRYPTION_KEY'),
]);
$ciphertext = $handler->encrypt(['user_id' => 42, 'role' => 'admin']);
// → "02006f1c…": hex string, safe to store in cookies / DBs / URL params
$plaintext = $handler->decrypt($ciphertext);
// → ['user_id' => 42, 'role' => 'admin']
use InitPHP\Encryption\Encrypt;
use InitPHP\Encryption\Sodium;
$handler = Encrypt::use(Sodium::class, [
'key' => getenv('APP_ENCRYPTION_KEY'),
]);
$ciphertext = $handler->encrypt('a secret message');
$plaintext = $handler->decrypt($ciphertext);