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

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

popphp/pop-cookie
=================

Pop Cookie Component for Pop PHP Framework

4.0.4(6mo ago)310.2k↑38.9%3BSD-3-ClausePHPPHP &gt;=8.3.0CI passing

Since Jul 9Pushed 6mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (1)Versions (19)Used By (3)

pop-cookie
==========

[](#pop-cookie)

[![Build Status](https://github.com/popphp/pop-cookie/workflows/phpunit/badge.svg)](https://github.com/popphp/pop-cookie/actions)[![Coverage Status](https://camo.githubusercontent.com/0d2deccdb2d706d384b459aa07efd1eefe732e4369b9af6b5344eae7b781ca46/687474703a2f2f63632e706f707068702e6f72672f636f7665726167652e7068703f636f6d703d706f702d636f6f6b6965)](http://cc.popphp.org/pop-cookie/)

[![Join the chat at https://discord.gg/TZjgT74U7E](https://camo.githubusercontent.com/acad7b0eeb78b78d08ffd2b85681ab243436388b5f86f8bcb956a69246e53739/68747470733a2f2f6d656469612e706f707068702e6f72672f696d672f646973636f72642e737667)](https://discord.gg/TZjgT74U7E)

- [Overview](#overview)
- [Install](#install)
- [Quickstart](#quickstart)

Overview
--------

[](#overview)

`pop-cookie` is a component used to securely create and manage cookies in a PHP web environment. With it, you can set and retrieve cookie values, as well as set required configuration options for the web application environment.

`pop-cookie` is a component of the [Pop PHP Framework](https://www.popphp.org/).

[Top](#pop-cookie)

Install
-------

[](#install)

Install `pop-cookie` using Composer.

```
composer require popphp/pop-cookie

```

Or, require it in your composer.json file

```
"require": {
    "popphp/pop-cookie" : "^4.0.4"
}

```

[Top](#pop-cookie)

Quickstart
----------

[](#quickstart)

The cookie object can be created using the `getInstance()` method, which takes an options array:

```
use Pop\Cookie\Cookie;

$cookie = Cookie::getInstance([
    'path'   => '/',
    'expire' => time() + 3600,
]);
```

### Available options

[](#available-options)

```
$options = [
    'path'     => '/',
    'expire'   => time() + 3600,
    'domain'   => 'www.domain.com',
    'secure'   => true,
    'httponly' => true,
    'samesite' => 'Lax'  // 'Lax', 'Strict', 'None'
];
```

From there, you can interact with the cookie object.

### Setting cookie values

[](#setting-cookie-values)

```
// Set cookie values
$cookie->foo = 'bar';
$cookie['baz'] = 123;
```

### Accessing cookie values

[](#accessing-cookie-values)

```
echo $cookie->foo;
echo $cookie['baz'];
```

### Unset cookie values

[](#unset-cookie-values)

```
unset($cookie->foo);
unset($cookie['baz']);
```

[Top](#pop-cookie)

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance66

Regular maintenance activity

Popularity28

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity87

Battle-tested with a long release history

 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 ~261 days

Recently: every ~180 days

Total

14

Last Release

200d ago

Major Versions

3.3.1 → 4.0.02023-11-09

PHP version history (8 changes)3.0.0PHP &gt;=5.4.0

3.1.0PHP &gt;=5.6.0

3.1.3PHP &gt;=7.1.0

3.3.0PHP &gt;=7.3.0

3.3.1PHP &gt;=7.4.0

4.0.0PHP &gt;=8.1.0

4.0.2PHP &gt;=8.2.0

4.0.4PHP &gt;=8.3.0

### Community

Maintainers

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

---

Top Contributors

[![nicksagona](https://avatars.githubusercontent.com/u/898670?v=4)](https://github.com/nicksagona "nicksagona (34 commits)")

---

Tags

phpcookiescookiepoppop php

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[josantonius/cookie

PHP library for handling cookies.

2238.7k4](/packages/josantonius-cookie)[marcogermani87/filament-cookie-consent

Easy cookie consent integrations for Filament

1917.0k](/packages/marcogermani87-filament-cookie-consent)

PHPackages © 2026

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