PHPackages                             richard8768/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. richard8768/cookie

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

richard8768/cookie
==================

The Hyperf Queued Cookie package.

v1.3(3w ago)01151MITPHPPHP &gt;=8.2

Since Feb 15Pushed 3mo agoCompare

[ Source](https://github.com/richard8768/cookie)[ Packagist](https://packagist.org/packages/richard8768/cookie)[ RSS](/packages/richard8768-cookie/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (26)Versions (7)Used By (1)

Hyperf Cookie 组件
================

[](#hyperf-cookie-组件)

该组件移植自 Laravel（[illuminate/cookie](https://github.com/illuminate/cookie)），功能与 Laravel 保持一致。

> 注意，该组件与 Hyperf 官方组件差异很大，使用时切勿混淆。

安装
--

[](#安装)

```
composer require hyperf-ext/cookie
```

发布配置
----

[](#发布配置)

```
php bin/hyperf.php vendor:publish hyperf-ext/cookie
```

> 配置文件位于 `config/autoload/cookie.php`。

设置
--

[](#设置)

在配置文件 `config/autoload/middlewares.php` 中添加全局中间件 `HyperfExt\Cookie\Middleware\QueuedCookieMiddleware`。

如需对 Cookie 加密，额外添加全局中间件 `HyperfExt\Cookie\Middleware\EncryptCookieMiddleware`。

> 注意，使用 Cookie 加密中间件需要依赖 [`hyperf-ext/encryption`](https://github.com/hyperf-ext/encryption) 组件。 并且需求将该中间件放置在其他需要处理 Cookie 的中间件之前，以保证将请求中的加密 Cookie 解密。

使用
--

[](#使用)

在任何需要设置 Cookie 的地方注入 `HyperfExt\Cookie\Contract\CookieJarInterface`，该接口绑定的是 `HyperfExt\Cookie\CookieJar` 的代理类实例对象。

该对象存储在当前请求的协程上下文中，在当前协程周期内访问到的都是同一个对象。

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance78

Regular maintenance activity

Popularity10

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 73.7% 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 ~303 days

Total

5

Last Release

21d ago

PHP version history (3 changes)v1.0PHP &gt;=8.0

v1.1PHP &gt;=8.1

v1.3PHP &gt;=8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/88701717?v=4)[richard8768](/maintainers/richard8768)[@richard8768](https://github.com/richard8768)

---

Top Contributors

[![richard8768](https://avatars.githubusercontent.com/u/88701717?v=4)](https://github.com/richard8768 "richard8768 (14 commits)")[![ericyzhu](https://avatars.githubusercontent.com/u/1786762?v=4)](https://github.com/ericyzhu "ericyzhu (5 commits)")

---

Tags

phpcookiehyperf

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[hyperf/watcher

Hot reload watcher for Hyperf

17904.9k31](/packages/hyperf-watcher)[hyperf/nano

Scale Hyperf application down to a single file

43413.9k2](/packages/hyperf-nano)[hyperf/crontab

A crontab component for Hyperf.

131.7M76](/packages/hyperf-crontab)[friendsofhyperf/sentry

The sentry component for Hyperf.

1974.5k](/packages/friendsofhyperf-sentry)

PHPackages © 2026

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