rosio / encrypted-cookie
Allows easy management of encrypted cookies
Installs: 6 646
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 3
Forks: 3
Open Issues: 1
Requires
- ext-mcrypt: *
Requires (Dev)
- mockery/mockery: ~0.9.0
- phpunit/phpunit: ~3.7.31
This package is not auto-updated.
Last update: 2024-11-23 15:53:10 UTC
README
Library provides basic functionality to easily create and manage encrypted cookies.
Based off of RFC 6896 KoanLogic's Secure Cookie Sessions for HTTP.
Testing
To run unit tests:
composer install
vendor/bin/phpunit
Quick Example
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();