1. Go to this page and download the library: Download bespredel/encryption-form 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/ */
bespredel / encryption-form example snippets
Add the middleware to your Kernel
protected $middleware = [
// Other middleware
\Bespredel\EncryptionForm\Middleware\DecryptRequestFields::class
]
Route::middleware('decrypt-form')->group(function () {
// Your code
})
use Bespredel\EncryptionForm\Services\RequestDecryptor;
$value = $request->input('name'); // Example for 'name' field
$privateKey = config('encryption-form.private_key');
$decryptedValue = RequestDecryptor::decryptValue($value, $privateKey);
$privateKey = config('encryption-form.private_key');
$encryptedData = $request->input('name'); // Example for 'name' field
$decryptedData = null;
$decodedValue = base64_decode((string)str($encryptedData)->after('ENCF:'), true);
openssl_private_decrypt($decodedValue, $decryptedData, $privateKey);
echo $decryptedData; // Output the decrypted value