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

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

hyperf-ext/cookie
=================

The Hyperf Queued Cookie package.

v2.2.0(4y ago)04.9k↓25%21MITPHPPHP &gt;=7.3

Since Sep 2Pushed 9mo ago1 watchersCompare

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

READMEChangelog (5)Dependencies (6)Versions (6)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

35

—

LowBetter than 80% of packages

Maintenance41

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 53.3% 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 ~82 days

Total

5

Last Release

1753d ago

PHP version history (2 changes)v2.0.0PHP &gt;=7.2

v2.1.0PHP &gt;=7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/6fc06d3a44afebb588f3eba3f7f2515527e1796fa061cda5aa95ece1e072510c?d=identicon)[EricYZhu](/maintainers/EricYZhu)

---

Top Contributors

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

---

Tags

cookiehyperfphpphpcookiehyperf

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[hyperf/watcher

Hot reload watcher for Hyperf

17846.7k27](/packages/hyperf-watcher)

PHPackages © 2026

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