💳 Decrypt Data
Decrypting sensitive data is as straightforward as encrypting it with Laravel Crypto. This package ensures secure decryption using the same algorithm and key that were used during encryption.
Using the Facade
The Crypto
facade provides a simple way to decrypt your data:
use Akira\LaravelCrypto\Facades\Crypto;
// Decrypt data
$decrypted = Crypto::decrypt($encryptedData);
// Output the decrypted string
echo $decrypted;
Using Dependency Injection
If you prefer using dependency injection, you can use the LaravelCrypto class directly:
use Akira\LaravelCrypto\LaravelCrypto;
use Akira\LaravelCrypto\LaravelCrypto;
public function decryptData(LaravelCrypto $crypto)
{
// Decrypt data
$decrypted = $crypto->decrypt($encryptedData);
// Output the decrypted string
echo $decrypted;
}