PHPackages                             httpsoft/http-cookie - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. httpsoft/http-cookie

ActiveLibrary[HTTP &amp; Networking](/categories/http)

httpsoft/http-cookie
====================

Managing cookies with PSR-7 support

1.1.0(3y ago)3163.3k↑106.2%12MITPHPPHP ^7.4|^8.0CI passing

Since Aug 30Pushed 1y ago1 watchersCompare

[ Source](https://github.com/httpsoft/http-cookie)[ Packagist](https://packagist.org/packages/httpsoft/http-cookie)[ Docs](https://httpsoft.org/)[ RSS](/packages/httpsoft-http-cookie/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (5)Dependencies (7)Versions (6)Used By (2)

HTTP Cookie
===========

[](#http-cookie)

[![License](https://camo.githubusercontent.com/c9eeea22007b226dd3f9f5433d30e93bcc330b9eb5e221c908f1b29f00c0d33e/68747470733a2f2f706f7365722e707567782e6f72672f68747470736f66742f687474702d636f6f6b69652f6c6963656e7365)](https://packagist.org/packages/httpsoft/http-cookie)[![Latest Stable Version](https://camo.githubusercontent.com/a5260fbde315600799991a3a2f3a2654c4e47a94d0a2db506055ed72acf17911/68747470733a2f2f706f7365722e707567782e6f72672f68747470736f66742f687474702d636f6f6b69652f76)](https://packagist.org/packages/httpsoft/http-cookie)[![Total Downloads](https://camo.githubusercontent.com/89d289ee82fa2d9e0eaed893275738d203ed61c93ce41d5706c30be9d4b432b3/68747470733a2f2f706f7365722e707567782e6f72672f68747470736f66742f687474702d636f6f6b69652f646f776e6c6f616473)](https://packagist.org/packages/httpsoft/http-cookie)[![GitHub Build Status](https://github.com/httpsoft/http-cookie/workflows/build/badge.svg)](https://github.com/httpsoft/http-cookie/actions)[![GitHub Static Analysis Status](https://github.com/httpsoft/http-cookie/workflows/static/badge.svg)](https://github.com/httpsoft/http-cookie/actions)[![Scrutinizer Code Coverage](https://camo.githubusercontent.com/d477dc9c81a1f9d65048d9b904dc6cba69c5ac99c6b521d5ea183fcce1500cf1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f68747470736f66742f687474702d636f6f6b69652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/httpsoft/http-cookie/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/bab255343f3e378f28afaaa61551678cc056fe6517304967cd7efcbc0ce6e5b1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f68747470736f66742f687474702d636f6f6b69652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/httpsoft/http-cookie/?branch=master)

This package provides convenient cookie management in accordance with the [RFC 6265](https://tools.ietf.org/html/rfc6265) specification.

This package supports [PSR-7](https://github.com/php-fig/http-message) and [PSR-15](https://github.com/php-fig/http-factory) interfaces.

Documentation
-------------

[](#documentation)

- [In English language](https://httpsoft.org/docs/cookie).
- [In Russian language](https://httpsoft.org/ru/docs/cookie).

Installation
------------

[](#installation)

This package requires PHP version 7.4 or later.

```
composer require httpsoft/http-cookie

```

Usage
-----

[](#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
// ...
```

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~244 days

Total

5

Last Release

1199d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7ab952aaa5ac8f82d6e96ef74c2f69082674a97eb3bc62f9d96c7304b2b4b082?d=identicon)[devanych](/maintainers/devanych)

---

Top Contributors

[![devanych](https://avatars.githubusercontent.com/u/20116244?v=4)](https://github.com/devanych "devanych (40 commits)")

---

Tags

cookiecookieshttphttp-cookiephppsr-15psr-7httppsr-7phppsr-15cookiescookiehttp-cookie

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/httpsoft-http-cookie/health.svg)

```
[![Health](https://phpackages.com/badges/httpsoft-http-cookie/health.svg)](https://phpackages.com/packages/httpsoft-http-cookie)
```

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.9k20.0M1.9k](/packages/cakephp-cakephp)[sunrise/http-router

A powerful solution as the foundation of your project.

16852.3k12](/packages/sunrise-http-router)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[mezzio/mezzio

PSR-15 Middleware Microframework

3973.9M133](/packages/mezzio-mezzio)[typo3/cms-adminpanel

TYPO3 CMS Admin Panel - The Admin Panel displays information about your site in the frontend and contains a range of metrics including debug and caching information.

115.8M71](/packages/typo3-cms-adminpanel)[eliashaeussler/typo3-solver

Solver - Extends TYPO3's exception handling with AI generated solutions. Problems can also be solved from command line. Several OpenAI parameters are configurable and prompts and solution providers can be customized as desired.

302.1k](/packages/eliashaeussler-typo3-solver)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
