PHPackages                             wpdiggerstudio/wpcookie - 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. wpdiggerstudio/wpcookie

ActiveLibrary

wpdiggerstudio/wpcookie
=======================

PHP library for handling cookies especially created for WPEngine hosted sites.

1.0.0(4y ago)07MITPHPPHP ^5.6 || ^7.0

Since Oct 7Pushed 4y ago1 watchersCompare

[ Source](https://github.com/WPDiggerStudio/WPCookie)[ Packagist](https://packagist.org/packages/wpdiggerstudio/wpcookie)[ RSS](/packages/wpdiggerstudio-wpcookie/feed)WikiDiscussions main Synced today

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

WPCookie
========

[](#wpcookie)

PHP library for handling cookies especially created for WPEngine hosted sites

---

- [Requirements](#requirements)
- [Installation](#installation)
- [Available Methods](#available-methods)
- [Quick Start](#quick-start)
- [Usage](#usage)
- [Tests](#tests)
- [License](#license)
- [Copyright](#copyright)

---

Requirements
------------

[](#requirements)

This library is supported by **PHP versions 5.6** or higher.

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

[](#installation)

The preferred way to install this extension is through [Composer](http://getcomposer.org/download/).

To install **WPCookie library**, simply:

```
$ composer require WPDiggerStudio/WPCookie

```

You can also **clone the complete repository** with Git:

```
$ git clone https://github.com/WPDiggerStudio/WPCookie.git

```

Available Methods
-----------------

[](#available-methods)

Available methods in this library:

### - Set cookie:

[](#--set-cookie)

```
Cookie::set($key, $value, $time);
```

AttributeDescriptionTypeRequiredDefault$keyCookie name.stringYes$valueThe data to save.stringYes$timeExpiration time in days.stringNo100**\# Return** (boolean)

### - Get item from cookie:

[](#--get-item-from-cookie)

```
Cookie::get($key);
```

AttributeDescriptionTypeRequiredDefault$keyCookie name.stringNo''**\# Return** (mixed|false) → returns cookie value or false

### - Extract item from cookie and delete cookie:

[](#--extract-item-from-cookie-and-delete-cookie)

```
Cookie::destroy($key);
```

AttributeDescriptionTypeRequiredDefault$keyCookie name to destroy. Not set to delete all.stringNo''**\# Return** (boolean)

### - Set cookie prefix:

[](#--set-cookie-prefix)

```
Cookie::setPrefix($prefix);
```

AttributeDescriptionTypeRequiredDefault$prefixCookie prefix.stringYes**\# Return** (boolean)

### - Get cookie prefix:

[](#--get-cookie-prefix)

```
Cookie::getPrefix();
```

**\# Return** (string) → cookie prefix

---

- Set cookie domain:
--------------------

[](#--set-cookie-domain)

```
Cookie::setDomain($domain);
```

AttributeDescriptionTypeRequiredDefault$domainCookie domain.stringYes**\# Return** (boolean)

### - Get cookie domain:

[](#--get-cookie-domain)

```
Cookie::getDomain();
```

**\# Return** (string) → cookie domain

- Set cookie secure:
--------------------

[](#--set-cookie-secure)

```
Cookie::setSecure($secure);
```

AttributeDescriptionTypeRequiredDefault$secureCookie secure.stringYes**\# Return** (boolean)

### - Get cookie secure:

[](#--get-cookie-secure)

```
Cookie::getSecure();
```

**\# Return** (string) → cookie secure

- Set cookie httpOnly:
----------------------

[](#--set-cookie-httponly)

```
Cookie::setHttpOnly($httpOnly);
```

AttributeDescriptionTypeRequiredDefault$httpOnlyCookie httpOnly.stringYes**\# Return** (boolean)

### - Get cookie httpOnly:

[](#--get-cookie-httponly)

```
Cookie::getHttpOnly();
```

**\# Return** (string) → cookie httpOnly

Quick Start
-----------

[](#quick-start)

To use this class with **Composer**:

```
require __DIR__ . '/vendor/autoload.php';

use WPDiggerStudio\WPCookie\WPCookie;
```

Or If you installed it **manually**, use it:

```
require_once __DIR__ . '/WPCookie.php';

use WPDiggerStudio\WPCookie\WPCookie;
```

Usage
-----

[](#usage)

Example of use for this library:

### - Set cookie:

[](#--set-cookie-1)

```
Cookie::set('cookie_name', 'value', 100);
```

### - Get cookie:

[](#--get-cookie)

```
Cookie::get('cookie_name');
```

### - Get all cookies:

[](#--get-all-cookies)

```
Cookie::get('all');
```

### - Destroy one cookie:

[](#--destroy-one-cookie)

```
Cookie::destroy('cookie_name');
```

### - Set cookie prefix:

[](#--set-cookie-prefix-1)

```
Cookie::setPrefix('prefix_');
```

### - Get cookie prefix:

[](#--get-cookie-prefix-1)

```
Cookie::getPrefix();
```

License
-------

[](#license)

This project is licensed under **MIT license**. See the [LICENSE](LICENSE) file for more info.

Copyright
---------

[](#copyright)

WPDiggerStudio, [wpdigger.com](https://wpdigger.com/)

If you find it useful, let me know 😉

You can contact me through my [email](mailto:admin@wpdigger.com).

###  Health Score

21

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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

1626d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/87be74120ef333e9f794308da1fdcb9505f3e1b255926014a144e6360bb29c08?d=identicon)[WPDiggerStudio](/maintainers/WPDiggerStudio)

---

Top Contributors

[![WPDiggerStudio](https://avatars.githubusercontent.com/u/55980087?v=4)](https://github.com/WPDiggerStudio "WPDiggerStudio (21 commits)")

---

Tags

handling-cookiesphp-cookiewpenginewpengine-cookiephpwordpresshhvmcookiesWPEngine

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/wpdiggerstudio-wpcookie/health.svg)

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

###  Alternatives

[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k22.8k](/packages/clouddueling-mysqldump-php)[alleyinteractive/pest-plugin-wordpress

WordPress Pest Integration

263.6k](/packages/alleyinteractive-pest-plugin-wordpress)

PHPackages © 2026

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