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)3139.8k↑15.9%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 1mo 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 86% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity63

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

1109d 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

[mezzio/mezzio-authentication

Authentication middleware for Mezzio and PSR-7 applications

121.6M26](/packages/mezzio-mezzio-authentication)[sunrise/http-router

A powerful solution as the foundation of your project.

16249.8k10](/packages/sunrise-http-router)[httpsoft/http-runner

Running PSR-7 components and building PSR-15 middleware pipelines

1455.0k5](/packages/httpsoft-http-runner)[httpsoft/http-basis

Simple and fast HTTP microframework implementing PSR standards

1334.9k1](/packages/httpsoft-http-basis)[wellrested/wellrested

Simple PHP Library for RESTful APIs

4818.7k4](/packages/wellrested-wellrested)[idealo/php-middleware-stack

Implementation of HTTP Middleware PSR-15 specification

318.9k](/packages/idealo-php-middleware-stack)

PHPackages © 2026

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