PHP code example of rosio / encrypted-cookie
1. Go to this page and download the library: Download rosio/encrypted-cookie 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/ */
rosio / encrypted-cookie example snippets
use Rosio\EncryptedCookie\CookieStorage;
use Rosio\EncryptedCookie\Cookie;
use Rosio\EncryptedCookie\CryptoSystem\AES_SHA;
// Used to create cookies with a given cryptoSystem
$storage = new CookieStorage(new AES_SHA('32charactercryptokeymustbe32chrs', 'HMACKey'));
// Create a cookie
$data = 'blah';
$cookie = Cookie::create('testCookie', $data);
$storage->save($cookie);
// Load the cookie
$newCookie = $storage->load('testCookie'); // Returns a PartialCookie
echo $newCookie->getData();