PHPackages                             temant/cookie-manager - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. temant/cookie-manager

ActiveLibrary[HTTP &amp; Networking](/categories/http)

temant/cookie-manager
=====================

A comprehensive PHP utility class for secure and efficient handling of HTTP cookies.

5.0.0(2y ago)0481MITPHPPHP ^8.3

Since Mar 25Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Slvstar/Temant-CookieManager)[ Packagist](https://packagist.org/packages/temant/cookie-manager)[ RSS](/packages/temant-cookie-manager/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (1)

CookieManager
=============

[](#cookiemanager)

`CookieManager` is a comprehensive PHP utility class designed for secure and efficient management of HTTP cookies. It abstracts the complexities involved in cookie management, providing an intuitive interface for setting, retrieving, checking, and deleting cookies. With built-in support for modern web security features like HttpOnly, Secure flags, and the SameSite attribute, `CookieManager` ensures your web applications handle cookies in a secure manner.

Features
--------

[](#features)

- **Secure Cookie Setting**: Easily set cookies with extensive options, ensuring compliance with security best practices.
- **Cookie Retrieval**: Safely retrieve the value of a specified cookie, mitigating the risk of unauthorized access.
- **Cookie Existence Check**: Quickly check whether a cookie exists, allowing for conditional logic based on cookie availability.
- **Cookie Deletion**: Efficiently delete cookies, with support for advanced options like path, domain, and security attributes.
- **Modern Security Compliance**: Embraces HttpOnly, Secure flags, and SameSite attribute to enhance protection against common web vulnerabilities like CSRF and XSS.

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

[](#installation)

Install `CookieManager` using Composer to seamlessly integrate it into your PHP project:

```
composer require temant/cookie-manager
```

Usage
-----

[](#usage)

Integrating `CookieManager` into your project is straightforward. Here are some common use cases:

### Setting a Cookie

[](#setting-a-cookie)

```
use Temant\CookieManager\CookieManager;

// Set a cookie with a 1-hour expiration
CookieManager::set('cookie_name', 'abc123', time() + 3600);
```

### Retrieving a Cookie

[](#retrieving-a-cookie)

```
// Get the value of a cookie
$userSession = CookieManager::get('cookie_name');
```

### Checking for a Cookie

[](#checking-for-a-cookie)

```
// Check if a cookie exists
$isLoggedIn = CookieManager::has('cookie_name');
```

### Deleting a Cookie

[](#deleting-a-cookie)

```
// Delete a cookie
CookieManager::delete('cookie_name');
```

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

[](#contributing)

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

Running Tests
-------------

[](#running-tests)

To run tests, navigate to the project directory and run the following command:

```
phpunit --bootstrap vendor/autoload.php tests
```

Ensure you have PHPUnit installed and configured correctly in your project.

License
-------

[](#license)

Distributed under the MIT License. See `LICENSE` for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

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

784d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3e96f21e803c229bcc4ec2e9b3f83535aa1723c9981a67d95513faee24e27d4f?d=identicon)[Slvstar](/maintainers/Slvstar)

---

Top Contributors

[![EmadAlmahdi](https://avatars.githubusercontent.com/u/135208774?v=4)](https://github.com/EmadAlmahdi "EmadAlmahdi (3 commits)")

---

Tags

httpphpsecuritycookie

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[hannesvdvreken/guzzle-debugbar

A Guzzle middleware that logs requests to debugbar's timeline

76410.4k1](/packages/hannesvdvreken-guzzle-debugbar)[swoole-bundle/swoole-bundle

Open/Swoole Symfony Bundle

6650.4k](/packages/swoole-bundle-swoole-bundle)

PHPackages © 2026

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