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

ActiveLibrary

phpatom/cookies
===============

A simple library to manage cookies on a PSR7 request

v0.1.0(5y ago)04MITPHP

Since Oct 4Pushed 5y agoCompare

[ Source](https://github.com/phpatom/cookies)[ Packagist](https://packagist.org/packages/phpatom/cookies)[ RSS](/packages/phpatom-cookies/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

### Cookies

[](#cookies)

![Status](https://camo.githubusercontent.com/263f3694f42afc27e06a1ff829cd63884893b55624e13a16893dd0a3ba772b94/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374617475732d6163746976652d737563636573732e737667)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](/LICENSE)

---

 A simple php library to manage cookies on PSR7 object

📝 Table of Contents
-------------------

[](#-table-of-contents)

- [Prerequisites](#prerequisites)
- [Installing](#installing)
- [Testing](#testing)
- [Coding Style](#coding_style)
- [Getting Started](#getting_started)
- [Usage](#usage)
- [Contributing](#contributing)
- [Authors](#authors)

Prerequisites
-------------------------------------------------------

[](#prerequisites-)

- PHP 7.3 +
- Composer

Installing
-------------------------------------------------

[](#installing-)

The recommended way to install is via Composer:

```
composer require phpatom/cookies

```

Testing Installing
------------------------------------------------------

[](#testing-installing-)

```
composer test

```

### Coding style

[](#coding-style-)

```
./vendor/bin/phpcs

```

Getting Started
-----------------------------------------------------------

[](#getting-started-)

### Basic usage

[](#basic-usage)

```
# create a new router

use Atom\Cookies\Cookie;
use Atom\Cookies\CookieConfig;

$myCookie = Cookie::create("foo","bar")
            ->withDomain("mydomain.com")
            ->withPath("/")
            ->thatExpiresOn("2 days");

$myCookie->applyTo($response); // ResponseInterface

// Cookie default config
CookieConfig::configure()
            ->withDomain("foo.com")
            ->withHttpOnly(true);

//will use default config
$myCookie = new Cookie("foo","bar");
echo $myCookie->getDomain(); // foo.com
echo $myCookie->isHttpOnly(); // true
```

### Read cookies

[](#read-cookies)

```
 $cookies = Cookies::of($request);
 echo $cookies->get("key"); //value
 echo $cookies->get("badkey",'defaultValue'); // defaultValue
 var_dump($cookies->getCookies("badkey")); // RequestCookie;
 echo $cookies->has("key"); //value boolean

 //also works with responses
 $cookies = Cookies::of($response);
 var_dump($cookies->getCookie("badkey")); // RequestCookie;Cookie
```

Contributing
-----------------------------------------------------

[](#contributing-)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

✍️ Author
---------------------------------------------

[](#️-author-)

- [@dani-gouken](https://github.com/dani-gouken) - Idea &amp; Initial work

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

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

Unknown

Total

1

Last Release

2044d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/60be0245dc2ad769d369accc8b2c8a4a6c68e0675c393562e825efb0b73d5c4d?d=identicon)[Nghokeng Daniel](/maintainers/Nghokeng%20Daniel)

---

Top Contributors

[![dani-gouken](https://avatars.githubusercontent.com/u/54918247?v=4)](https://github.com/dani-gouken "dani-gouken (6 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[league/uri-interfaces

Common tools for parsing and resolving RFC3987/RFC3986 URI

538204.9M23](/packages/league-uri-interfaces)[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k20](/packages/neuron-core-neuron-ai)[simplesamlphp/saml2

SAML2 PHP library from SimpleSAMLphp

30317.2M40](/packages/simplesamlphp-saml2)[php-heroku-client/php-heroku-client

A PHP client for the Heroku Platform API

24404.8k4](/packages/php-heroku-client-php-heroku-client)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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