rosio / encrypted-cookie
允许轻松管理加密cookie
v1.0.0
2014-03-03 23:01 UTC
Requires
- ext-mcrypt: *
Requires (Dev)
- mockery/mockery: ~0.9.0
- phpunit/phpunit: ~3.7.31
This package is not auto-updated.
Last update: 2024-09-28 15:08:27 UTC
README
该库提供基本功能,可轻松创建和管理加密cookie。
基于 RFC 6896 KoanLogic的Secure Cookie Sessions for HTTP。
测试
运行单元测试
composer install
vendor/bin/phpunit
快速示例
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();