PHPackages                             phpsoftbox/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. phpsoftbox/cookie

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

phpsoftbox/cookie
=================

Cookie component for the PhpSoftBox framework

0145↓90.8%PHP

Since Mar 5Pushed 5mo agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Cookie
======

[](#cookie)

Компонент для работы с Cookie и Set-Cookie.

Пример
------

[](#пример)

```
use PhpSoftBox\Cookie\CookieJar;
use PhpSoftBox\Cookie\SetCookie;

$cookies = CookieJar::fromHeader('a=1; b=2');

$setCookie = SetCookie::create('sid', 'token')
    ->withHttpOnly(true)
    ->withSecure(true);

$headers = CookieJar::toHeaders([$setCookie]);
```

Middleware
----------

[](#middleware)

```
use PhpSoftBox\Cookie\CookieMiddleware;
use PhpSoftBox\Cookie\CookieQueue;
use PhpSoftBox\Cookie\SetCookie;

$queue = new CookieQueue();
$middleware = new CookieMiddleware($queue);

$queue->queue(SetCookie::create('token', 'abc'));
```

### Шифрование cookie

[](#шифрование-cookie)

Можно включить шифрование значений cookie через `phpsoftbox/encryptor`. Для исключений (например, сессионная cookie или `XSRF-TOKEN`) передайте список `except`.

```
use PhpSoftBox\Cookie\CookieMiddleware;
use PhpSoftBox\Cookie\CookieQueue;
use PhpSoftBox\Encryptor\Encryptor;

$encryptor = new Encryptor(defaultKey: $_ENV['APP_KEY'] ?? null);

$middleware = new CookieMiddleware(
    queue: new CookieQueue(),
    encryptor: $encryptor,
    except: ['XSRF-TOKEN', 'psb_session'],
);
```

###  Health Score

21

—

LowBetter than 17% of packages

Maintenance49

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0279d150240c97d210034878b0467462246dc14d29b5618157ff6a8be49a50e3?d=identicon)[inspector-who](/maintainers/inspector-who)

---

Top Contributors

[![inspector-who](https://avatars.githubusercontent.com/u/6973963?v=4)](https://github.com/inspector-who "inspector-who (1 commits)")

### Embed Badge

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

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

###  Alternatives

[trntv/probe

System information provider

34694.8k5](/packages/trntv-probe)[setono/sylius-feed-plugin

Plugin to generate feeds within the Sylius ecommerce platform

26482.1k](/packages/setono-sylius-feed-plugin)[microman/kirby-column-blocks

Use columns in block fields based on the layout field.

432.8k](/packages/microman-kirby-column-blocks)[friends-of-hyva/magento2-crawler-session

Prevent crawlers from creating a session

167.3k](/packages/friends-of-hyva-magento2-crawler-session)

PHPackages © 2026

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