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

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

wan/raw-cookie
==============

1.0.1(8y ago)112MITPHP

Since Jul 25Pushed 8y ago1 watchersCompare

[ Source](https://github.com/wanguowan/composer.RawCookie)[ Packagist](https://packagist.org/packages/wan/raw-cookie)[ RSS](/packages/wan-raw-cookie/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

composer.RawCookie
==================

[](#composerrawcookie)

简介
--

[](#简介)

Laravel框架下，设置Raw Cookie

Laravel 5.3及5.4框架Cookie::queue已支持setrawcookie，但是5.1及5.2中暂不支持。 通过安装这个包后，简单配置后即可实现同样功能。

优势：
---

[](#优势)

相对于原生的setcookie及setrawcookie，使用该包后可以优雅的使用切面编程，对已经设置的cookie进行取消操作。而不需要侵入到业务代码中，根据业务逻辑判断是否设置该cookie

安装：
---

[](#安装)

```
composer require wan/raw-cookie

```

配置：
---

[](#配置)

### 配置Providers

[](#配置providers)

修改config/app.php配置文件，在providers数组中，添加服务提供者

```
'providers' => [
    // ...
    \Wan\RawCookie\Providers\RawCookieServiceProvider::class,
]

```

### 配置Class Aliases

[](#配置class-aliases)

修改config/app.php配置文件，在aliases数组中，添加别名

```
'aliases' => [
    'RawCookie' => \Wan\RawCookie\Facade\RawCookie::class,
]

```

### 配置Middleware

[](#配置middleware)

修改app/Http/Kernel.php

Laravel5.2：在$middlewareGroups=&gt;web中添加

```
protected $middlewareGroups = [
    'web' => [
       // ...
       \Wan\RawCookie\Middleware\AddQueuedRawCookiesToResponse::class,
   ],
    // ...
];

```

Laravel5.1:在$middleware中添加

```
protected $middleware =
	[
	   // ...
		\Wan\RawCookie\Middleware\AddQueuedRawCookiesToResponse::class,
	];

```

使用
--

[](#使用)

在需要添加cookie的地方，使用下面代码添加

```
use RawCookie;

// ...
RawCookie::queue( $key, $value, $expire, $path, $domain, $secure, $httponly, $raw )

```

在需要取消添加cookie的地方，使用下面代码

```
use RawCookie;

// ...
RawCookie::unqueue( $key );

```

判断是否添加了cookie

```
use RawCookie;

// ...
RawCookie::queued( $key );

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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

Every ~1 days

Total

2

Last Release

3213d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e089f0a8fc2ea6a20bc9e9b87bd711db7b6c804229c9c21b6a09fc9e771e0b2e?d=identicon)[wanguowan](/maintainers/wanguowan)

---

Top Contributors

[![wanguowan](https://avatars.githubusercontent.com/u/11828401?v=4)](https://github.com/wanguowan "wanguowan (12 commits)")

### Embed Badge

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

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

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)

PHPackages © 2026

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