PHP code example of spaze / encryption
1. Go to this page and download the library: Download spaze/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/ */
spaze / encryption example snippets
bin2hex(random_bytes(32))
use Spaze\Encryption\SymmetricKeyEncryption;
class Something
{
public function __construct(
private SymmetricKeyEncryption $emailEncryption,
) {
// ...
}
public function doSomething()
{
// ...
$encryptedEmail = $this->emailEncryption->encrypt($email);
// ...
}
public function doSomethingElse()
{
// ...
$decryptedEmail = $this->emailEncryption->decrypt($email);
// ...
}
}