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

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

webiik/cookie
=============

The Cookie provides safe way to work with cookies.

1.0(7y ago)1842MITPHPPHP &gt;=7.2

Since Feb 28Pushed 7y ago1 watchersCompare

[ Source](https://github.com/webiik/cookie)[ Packagist](https://packagist.org/packages/webiik/cookie)[ Docs](https://www.webiik.com)[ RSS](/packages/webiik-cookie/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (2)Used By (2)

[![](https://camo.githubusercontent.com/a397347ee4fb199934fee6354504f4702b89f5c22f0ce0ba94c5ff691cde545c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f77656269696b2f77656269696b2e737667)](https://camo.githubusercontent.com/a397347ee4fb199934fee6354504f4702b89f5c22f0ce0ba94c5ff691cde545c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f77656269696b2f77656269696b2e737667)[![](https://camo.githubusercontent.com/20f4b99a958aadb02ff273ac6428c17cf55c6b817657ed64b1c39c7f71955a0e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646570656e64656e636965732d302d627269676874677265656e2e737667)](https://camo.githubusercontent.com/20f4b99a958aadb02ff273ac6428c17cf55c6b817657ed64b1c39c7f71955a0e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646570656e64656e636965732d302d627269676874677265656e2e737667)

Cookie
======

[](#cookie)

The Cookie provides safe way to work with cookies.

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

[](#installation)

```
composer require webiik/cookie
```

Example
-------

[](#example)

```
$cookie = new \Webiik\Cookie\Cookie();
$cookie->setCookie('foo', 'bar');
if ($cookie->isCookie('foo')) {
    echo 'Cookie foo has value: ' . $cookie->getCookie('foo');
}
$cookie->delCookie('foo');
```

Configuration
-------------

[](#configuration)

### setDomain

[](#setdomain)

```
setDomain(string $domain): void
```

**setDomain()** sets the (sub)domain that the cookie is available to.

```
$cookie->setDomain('mydomain.tld');
```

### setUri

[](#seturi)

```
setUri(string $uri): void
```

**setUri()** sets the path on the server in which the cookie will be available on.

```
$cookie->setUri('/');
```

### setSecure

[](#setsecure)

```
setSecure(bool $bool): void
```

**setSecure()** indicates that the cookie should only be transmitted over a secure HTTPS connection from the client. The default value is **FALSE**.

```
$cookie->setSecure(true);
```

### setHttpOnly

[](#sethttponly)

```
setHttpOnly(bool $bool): void
```

**setHttpOnly()** indicates that the cookie should only be accessible through the HTTP protocol. The default value is **FALSE**.

```
$cookie->setHttpOnly(true);
```

Adding
------

[](#adding)

### setCookie

[](#setcookie)

```
setCookie(string $name, string $value = '', int $expire = 0, string $uri = '', string $domain = '', bool $secure = false, bool $httponly = false): bool
```

**setCookie()** sets a cookie to be sent along with the rest of the HTTP headers.

```
$cookie->setCookie('foo', 'bar');
```

Check
-----

[](#check)

### isCookie

[](#iscookie)

```
isCookie(string $name): bool
```

**isCookie()** determines if a cookie is set. Returns **TRUE** if cookie exists.

```
$cookie->isCookie('foo');
```

Getting
-------

[](#getting)

### getCookie

[](#getcookie)

```
getCookie(string $name): string
```

**getCookie()** gets a cookie by **$name** and returns its value.

```
$cookie->getCookie('foo');
```

Deletion
--------

[](#deletion)

### delCookie

[](#delcookie)

```
delCookie($name): void
```

**delCookie()** removes a cookie by **$name**.

```
$cookie->delCookie('foo');
```

### delCookies

[](#delcookies)

```
delCookies(): void
```

**delCookies()** removes all cookies.

```
$cookie->delCookies();
```

Resources
---------

[](#resources)

- [Webiik framework](https://github.com/webiik/webiik)
- [Report issue](https://github.com/webiik/components/issues)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community11

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

Unknown

Total

1

Last Release

2632d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1226362d003d186b45e7dfa44489c36af37196c6a1b476206700eaf4e9c96a5a?d=identicon)[Jiri Mihal](/maintainers/Jiri%20Mihal)

---

Top Contributors

[![Jiri-Mihal](https://avatars.githubusercontent.com/u/10408123?v=4)](https://github.com/Jiri-Mihal "Jiri-Mihal (129 commits)")

---

Tags

cookie

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-cookie-consent

Make your Laravel app comply with the crazy EU cookie law

1.5k4.7M20](/packages/spatie-laravel-cookie-consent)[statikbe/laravel-cookie-consent

Cookie consent modal for EU

213396.7k](/packages/statikbe-laravel-cookie-consent)[oveleon/contao-cookiebar

Contao Cookiebar

63124.1k6](/packages/oveleon-contao-cookiebar)[dirkpersky/typo3-dp_cookieconsent

Enable a cookie consent box. Let you visitors control the usage of cookies and load script or content after a consent. (ePrivacy, TTDSG)

36201.3k1](/packages/dirkpersky-typo3-dp-cookieconsent)[xsuchy09/utm-cookie

Utm-Cookie saves utm parameters from url into cookie with defined lifetime (default 7 days). Than cookie (utm) can be used later without parsing google or any other cookies.

1456.1k2](/packages/xsuchy09-utm-cookie)[bizley/cookiemonster

Yii extension to manage cookie warning.

2020.1k1](/packages/bizley-cookiemonster)

PHPackages © 2026

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