PHPackages                             leafs/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. [Framework](/categories/framework)
4. /
5. leafs/cookie

ActiveLibrary[Framework](/categories/framework)

leafs/cookie
============

Leaf PHP cookie module

v4.0(1y ago)23.5k—0%MITPHP

Since Sep 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/leafsphp/cookie)[ Packagist](https://packagist.org/packages/leafs/cookie)[ Docs](https://leafphp.netlify.app/#/)[ GitHub Sponsors](https://github.com/leafsphp)[ Fund](https://opencollective.com/leaf)[ RSS](/packages/leafs-cookie/feed)WikiDiscussions main Synced today

READMEChangelog (6)DependenciesVersions (7)Used By (0)

 [![](https://camo.githubusercontent.com/e83224618735d048f0f70f04e02d7973a634a055e18d47fe22501e3a85e40b9f/68747470733a2f2f6c6561667068702e6e65746c6966792e6170702f6173736574732f696d672f6c656166332d6c6f676f2e706e67)](https://camo.githubusercontent.com/e83224618735d048f0f70f04e02d7973a634a055e18d47fe22501e3a85e40b9f/68747470733a2f2f6c6561667068702e6e65746c6966792e6170702f6173736574732f696d672f6c656166332d6c6f676f2e706e67)

Leaf Cookie Module
==================

[](#leaf-cookie-module)

[![Latest Stable Version](https://camo.githubusercontent.com/8eaf74a8d728c287af005e6101985dbee9dd5f46867368570caf2178d9d3fd9b/68747470733a2f2f706f7365722e707567782e6f72672f6c656166732f636f6f6b69652f762f737461626c65)](https://packagist.org/packages/leafs/cookie)[![Total Downloads](https://camo.githubusercontent.com/50cdeebf0791c0185b9043e960aa4ccc3156cfadf8b1d8b681644e1e0870ef1e/68747470733a2f2f706f7365722e707567782e6f72672f6c656166732f636f6f6b69652f646f776e6c6f616473)](https://packagist.org/packages/leafs/cookie)[![License](https://camo.githubusercontent.com/e34100e05b857fa1695e9b6cb273149406f86b2b4ef4e8d25723abf83deccd8b/68747470733a2f2f706f7365722e707567782e6f72672f6c656166732f636f6f6b69652f6c6963656e7365)](https://packagist.org/packages/leafs/cookie)

Leaf's cookie module provides a wrapper around the built-in PHP cookie functions. It provides a cleaner and more expressive API working with cookies while maintaining full compatibility with PHP's built-in cookie functions.

Installation
------------

[](#installation)

You can easily install Leaf using [Composer](https://getcomposer.org/).

```
composer require leafs/cookie
```

Usage
-----

[](#usage)

Once installed, it merges with Leaf's core, so you can use it like so:

```
response()
  ->withCookie('name', 'Fullname')
  ->withCookie('age', 20)
  ->json([
      'message' => 'Cookies set'
    ]);
```

Or on its own:

```
cookie()->set('name', 'Fullname', [
  'expire' => time() + 3600,
  'path' => '/',
  'domain' => 'example.com',
  'secure' => true,
  'httponly' => true,
  'samesite' => 'None'
]);
```

Stay In Touch
-------------

[](#stay-in-touch)

- [Twitter](https://twitter.com/leafphp)
- [Join the forum](https://github.com/leafsphp/leaf/discussions/37)
- [Chat on discord](https://discord.com/invite/Pkrm9NJPE3)

Learning Leaf PHP
-----------------

[](#learning-leaf-php)

- Leaf has a very easy to understand [documentation](https://leafphp.dev) which contains information on all operations in Leaf.
- You can also check out our [youtube channel](https://www.youtube.com/channel/UCllE-GsYy10RkxBUK0HIffw) which has video tutorials on different topics
- You can also learn from [codelabs](https://leafphp.dev/codelabs/) and contribute as well.

Contributing
------------

[](#contributing)

We are glad to have you. All contributions are welcome! To get started, familiarize yourself with our [contribution guide](https://leafphp.dev/community/contributing.html) and you'll be ready to make your first pull request 🚀.

To report a security vulnerability, you can reach out to [@mychidarko](https://twitter.com/mychidarko) or [@leafphp](https://twitter.com/leafphp) on twitter. We will coordinate the fix and eventually commit the solution in this project.

Sponsoring Leaf
---------------

[](#sponsoring-leaf)

We are committed to keeping Leaf open-source and free, but maintaining and developing new features now requires significant time and resources. As the project has grown, so have the costs, which have been mostly covered by the team. To sustain and grow Leaf, we need your help to support full-time maintainers.

You can sponsor Leaf and any of our packages on [open collective](https://opencollective.com/leaf) or check the [contribution page](https://leafphp.dev/support/) for a list of ways to contribute.

And to all our [existing cash/code contributors](https://leafphp.dev#sponsors), we love you all ❤️

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance42

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

Every ~252 days

Recently: every ~218 days

Total

6

Last Release

485d ago

Major Versions

v1.3 → v4.02025-03-06

### Community

Maintainers

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

---

Top Contributors

[![mychidarko](https://avatars.githubusercontent.com/u/26604242?v=4)](https://github.com/mychidarko "mychidarko (18 commits)")

---

Tags

httpphpframeworkcookiesleaf

### Embed Badge

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

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

###  Alternatives

[leafs/leaf

Elegant PHP for modern developers

1.3k48.6k11](/packages/leafs-leaf)[utopia-php/framework

A simple, light and advanced PHP HTTP framework

295694.5k11](/packages/utopia-php-framework)[utopia-php/http

A simple, light and advanced PHP HTTP framework

29555.2k7](/packages/utopia-php-http)

PHPackages © 2026

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