httpsoft/http-cookie 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

httpsoft/http-cookie

最新稳定版本:1.1.0

Composer 安装命令:

composer require httpsoft/http-cookie

包简介

Managing cookies with PSR-7 support

README 文档

README

License Latest Stable Version Total Downloads GitHub Build Status GitHub Static Analysis Status Scrutinizer Code Coverage Scrutinizer Code Quality

This package provides convenient cookie management in accordance with the RFC 6265 specification.

This package supports PSR-7 and PSR-15 interfaces.

Documentation

Installation

This package requires PHP version 7.4 or later.

composer require httpsoft/http-cookie

Usage

use HttpSoft\Cookie\Cookie;
use HttpSoft\Cookie\CookieCreator;
use HttpSoft\Cookie\CookieManager;
use HttpSoft\Cookie\CookieSendMiddleware;

/**
 * @var Psr\Http\Message\ResponseInterface $response
 * @var Psr\Http\Message\ServerRequestInterface $request
 * @var Psr\Http\Server\RequestHandlerInterface $handler
 */
 
$manager = new CookieManager();

// Create cookie
$cookie1 = new Cookie('test', 'value', '+1 hour');
// or
$cookie2 = CookieCreator::create('test2', 'value', time() + 3600, '.example.com', '/path');
// or from raw `Set-Cookie` header
$cookie3 = CookieCreator::createFromString('name=value; Path=/; Secure; HttpOnly; SameSite=Lax; ...');

// Set cookies to the manager
$manager->set($cookie1);
$manager->set($cookie2);
$manager->set($cookie3);

// Set all cookie to the response for sending
$response = $manager->send($response);
// or use `CookieSendMiddleware` middleware
$middleware = new CookieSendMiddleware($manager);
$response = $middleware->process($request, $handler);

// Emit a response to the client
// ...

统计信息

  • 总下载量: 126.32k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 3
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固