Encryption library bundled with Zest.
The default encryption adapter in config file Config/App.php is set openssl
::: warning
You should change your encryption key
:::
You can encrypt string by calling to encrypt method
<?php
use Zest\Encryption\Encryption;
$encryption = new Encryption('your-key'); // key is optional
//Encrypt the message
$encrypt = $encryption->encrypt("This is a text");
echo $encrypt;You can decrypt token by calling decrypt method
<?php
$encryption = new Encryption('your-key');
//Decrypt the message
$decrypt = $encryption->decrypt($encrypt);
echo $decrypt;This Package support two encryption adapter
- OpenSSL
- Sodium
You can pass supported adapter to class like
Use of sodium
<?php
$encryption = new Encryption('your-key','sodium');::: danger Sodium php extension is required. :::
Use of openSSL
::: tip
The adapter can also be changed from Config/App.php file.
:::
<?php
$encryption = new Encryption('your-key','openssl');::: danger openSSL php extension is required. :::