PHPackages                             constanze-standard/cookies - 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. constanze-standard/cookies

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

constanze-standard/cookies
==========================

Cookie support for PSR-7 response.

1.1.0(6y ago)05Apache-2.0PHPPHP ^7.1.3CI failing

Since Sep 27Pushed 6y agoCompare

[ Source](https://github.com/constanze-standard/cookies)[ Packagist](https://packagist.org/packages/constanze-standard/cookies)[ RSS](/packages/constanze-standard-cookies/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

Constanze Standard: Cookies
===========================

[](#constanze-standard-cookies)

Cookie support for PSR-7 response.

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

[](#installation)

```
composer require constanze-standard/cookies
```

Usage
-----

[](#usage)

Add a Cookie to collection with `addCookie`.

```
use ConstanzeStandard\Cookies\Cookie;
use ConstanzeStandard\Cookies\CookieCollection;

$cookie = new Cookie('name', 'value', 60);

$cookieCollection = new CookieCollection();
$cookieCollection->addCookie($cookie);
```

Or you can add cookie with method `add`, it will return the new created `Cookie` instance:

```
use ConstanzeStandard\Cookies\CookieCollection;

$cookieCollection = new CookieCollection();
/** @var \ConstanzeStandard\Cookies\Cookie $cookie */
$cookie = $cookieCollection->add('name', 'value', 60);
```

The cookie's arguments:

- `string $name` The name of the cookie.
- `string $value` The value of the cookie.
- `int $expireTime` The time of cookie expires relatively to current timestamp.
- `string $path` The path on the server in which the cookie will be available on.
- `string $domain` The (sub)domain that the cookie is available to.
- `bool $secure` Indicates that the cookie should only be transmitted over a secure HTTPS connection from the client.
- `bool $httponly` When TRUE the cookie will be made accessible only through the HTTP protocol.

You can set default value for `domain` and `secure` with construct of `CookieCollection`.

```
$cookieCollection = new CookieCollection('localhost', true);
```

If you add a cookie with empty `domain` or `secure`, the collection will use the default value.

Set cookies for PSR-7 response:

```
/**
 * @var \Psr\Http\Message\ResponseInterface $response
 * @var \Psr\Http\Message\ResponseInterface $newResponse
 */
$newResponse = $cookieCollection->makeResponse($response);
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 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 ~50 days

Total

2

Last Release

2369d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f4cfe2ff9c9a5fe469dd2701b7c22132e5b5a9e053a32c54d7ae90cfe565ef3?d=identicon)[Alex Layton](/maintainers/Alex%20Layton)

---

Top Contributors

[![alex-1900](https://avatars.githubusercontent.com/u/49949411?v=4)](https://github.com/alex-1900 "alex-1900 (8 commits)")

---

Tags

cookiephppsrpsr-7responseresponsepsrpsr-7cookiescookie

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/constanze-standard-cookies/health.svg)

```
[![Health](https://phpackages.com/badges/constanze-standard-cookies/health.svg)](https://phpackages.com/packages/constanze-standard-cookies)
```

###  Alternatives

[psr/http-message

Common interface for HTTP messages

7.1k1.0B5.5k](/packages/psr-http-message)[psr/http-factory

PSR-17: Common interfaces for PSR-7 HTTP message factories

1.9k692.9M1.9k](/packages/psr-http-factory)[fig/http-message-util

Utility classes and constants for use with PSR-7 (psr/http-message)

39489.0M274](/packages/fig-http-message-util)[psr/http-server-handler

Common interface for HTTP server-side request handler

175101.3M921](/packages/psr-http-server-handler)[psr/http-server-middleware

Common interface for HTTP server-side middleware

18091.2M1.5k](/packages/psr-http-server-middleware)[art4/requests-psr18-adapter

Use WordPress/Requests as a PSR-18 HTTP client

153.3k](/packages/art4-requests-psr18-adapter)

PHPackages © 2026

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