PHP code example of nabeghe / simple-cipher
1. Go to this page and download the library: Download nabeghe/simple-cipher 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/ */
nabeghe / simple-cipher example snippets
SimpleCipher::encrypt(mixed $data, array|string|int|null $config): string;
SimpleCipher::decrypt(string $data, array|string|int|null $config): mixed;
use Nabeghe\SimpleCipher\SimpleCipher;
$data = 'nabeghe/simple-cipher';
$encrypted = SimpleCipher::encrypt($data, 'YOUR_SECRET');
echo "Encrypted Data:\n";
echo "$encrypted\n\n";
$decrypted = SimpleCipher::decrypt($encrypted, 'YOUR_SECRET');
echo "Decrypted Data:\n";
var_dump($decrypted);
__construct(array|string|int|null $config = null)
$cipher->encrypt(mixed $data): string;
$cipher->decrypt(string $data, mixed $default = null): mixed;
use Nabeghe\SimpleCipher\SimpleCipher;
$data = 'nabeghe/simple-cipher';
$cipher = new SimpleCipher('YOUR_SECRET');
$encrypted = $cipher->encrypt($data);
echo "Encrypted Data:\n";
echo "$encrypted\n\n";
$decrypted = $cipher->decrypt($encrypted);
echo "Decrypted Data:\n";
var_dump($decrypted);