1. Go to this page and download the library: Download friendsofhyperf/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/ */
friendsofhyperf / encryption example snippets
use function FriendsOfHyperf\Encryption\decrypt;
use function FriendsOfHyperf\Encryption\encrypt;
$payload = encrypt(['id' => 1]);
$value = decrypt($payload);
use FriendsOfHyperf\Encryption\Contract\StringEncrypter;
class TokenService
{
public function __construct(private StringEncrypter $encrypter)
{
}
public function encrypt(string $token): string
{
return $this->encrypter->encryptString($token);
}
}
use FriendsOfHyperf\Encryption\Encrypter;
$encrypter->previousKeys([
base64_decode('PREVIOUS_BASE64_KEY'),
]);