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

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

gemingcao/cookie-helper
=======================

This is a general-purpose class that allows to manage PHP built-in cookies and the cookies variables passed via $\_COOKIE superglobal

v1.0.1(7y ago)0151MITPHPPHP &gt;=5.5

Since Sep 26Pushed 7y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (1)

cookie-helper
=============

[](#cookie-helper)

一个操作`$_COOKIE`的类。

安装
--

[](#安装)

在你的`composer.json`，`require`项添加：

```
"gemingcao/cookie-helper": "~1.0"

```

或者`composer`直接安装：

```
composer require gemingcao/cookie-helper:~1.0
```

Cookie helper
-------------

[](#cookie-helper-1)

你可以全局实例化`CookieHelper`类：

```
  $cookie = new \Gemingcao\Helper\CookieHelper();

  // 检测cookie是否存在
  $exists = $cookie->exists('my_key');
  $exists = isset($cookie->my_key);
  $exists = isset($cookie['my_key']);

  // 获取一个cookie
  $my_value = $cookie->get('my_key', 'default');
  $my_value = $cookie->my_key;
  $my_value = $cookie['my_key'];

  // 设置一个cookie
  $app->cookie->set('my_key', 'my_value');
  $cookie->my_key = 'my_value';
  $cookie['my_key'] = 'my_value';

  // 合并cookie数组
  $app->cookie->merge('my_key', ['first' => 'value']);
  $cookie->merge('my_key', ['second' => ['a' => 'A']]);
  $letter_a = $cookie['my_key']['second']['a'];  // "A"

  // 删除一个cookie
  $cookie->delete('my_key');
  unset($cookie->my_key);
  unset($cookie['my_key']);

  // 销毁cookie
  $cookie::destroy();
```

License
-------

[](#license)

MIT

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

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

2833d ago

### Community

Maintainers

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

---

Top Contributors

[![gemingcao](https://avatars.githubusercontent.com/u/2102603?v=4)](https://github.com/gemingcao "gemingcao (5 commits)")

---

Tags

helpercookie

### Embed Badge

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

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k129.4M833](/packages/barryvdh-laravel-ide-helper)[spatie/laravel-cookie-consent

Make your Laravel app comply with the crazy EU cookie law

1.5k4.9M24](/packages/spatie-laravel-cookie-consent)[bryanjhv/slim-session

Session middleware and helper for Slim framework 4.

233990.5k16](/packages/bryanjhv-slim-session)[beste/json

A simple JSON helper to decode and encode JSON

4225.4M3](/packages/beste-json)[chillerlan/php-settings-container

A container class for immutable settings objects. Not a DI container.

3432.2M22](/packages/chillerlan-php-settings-container)[kartik-v/yii2-helpers

A collection of useful helper functions for Yii Framework 2.0

883.1M29](/packages/kartik-v-yii2-helpers)

PHPackages © 2026

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