fruit/cookiekit

此包的最新版本(0.0.2)没有可用的许可信息。

Fruit框架的Cookie怪物

0.0.2 2016-01-25 08:35 UTC

This package is auto-updated.

Last update: 2024-09-19 00:59:58 UTC


README

此包是Fruit框架的一部分。

CookieKit是一套帮助您管理Web应用程序cookie的工具。

Build Status

CookieKit仍在开发中,目前不可用。

摘要

基本上,将其视为普通数组。

$cookies = new Fruit\CookieKit\Cookie;
$myval = $cookies['mykey'];
unset($cookies['mykey']);
// do something, and then
$cookies['anotherkey'] = $anotherval;
$cookies->send(); // send Set-Cookies header

不仅支持PHP内建的cookie

定义明确的 CookieSetter 接口使得您可以在几乎所有平台上更容易地使用CookieKit。例如,对于您的PHPSGI应用程序,您甚至不需要自己编写 CookieSetter

$headers = [];
$setter = new PeclHttpCookieSetter($environment['Cookies'], function($str) use ($headers) {
	$headers['Set-Cookies'] = $str;
});
$cookies = new Cookie($setter);
$cookies['mykey'] = $myval;
$cookies->send();
return [200, $headers, 'hello, world'];

注意:当稳定版推出时,CookieKit可能将对PHPSGI提供适当的支持。

许可

任何版本的MIT、GPL或LGPL。