PHP code example of arispati / crypto-aes

1. Go to this page and download the library: Download arispati/crypto-aes 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/ */

    

arispati / crypto-aes example snippets


use Arispati\CryptoAES\CryptoAES;

// Set the secret key
$secretKey = 's3cr3tK3y'; // default secret key

// Initilize CryptoAES Class
$crypto = new CryptoAES($secretKey);

// Encrypt
$encrypted = $crypto->encrypt('Hello World');
// {"ct":"7aV+gq6hm69IO1\/pyjPliQ==","iv":"ece63be3d70d2e275396e3b82a43f425","s":"655cc08d5bcfd469"}

// Decrypt
$decrypted = $crypto->decrypt($encrypted);
// "Hello World"