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

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

eden/cookie
===========

Client side persistent data

4.0.1(10y ago)17.7k1MITPHPPHP &gt;=5.4.1

Since Oct 9Pushed 10y ago3 watchersCompare

[ Source](https://github.com/Eden-PHP/Cookie)[ Packagist](https://packagist.org/packages/eden/cookie)[ Docs](http://eden-php.com)[ RSS](/packages/eden-cookie/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)Dependencies (1)Versions (5)Used By (1)

[![logo](https://camo.githubusercontent.com/683ba05b2b51f50045c674b19a4f0ceb30702a8ab495623be7c02e07ab226f08/687474703a2f2f6564656e2e6f70656e6f766174652e636f6d2f6173736574732f696d616765732f636c6f75642d736f6369616c2e706e67)](https://camo.githubusercontent.com/683ba05b2b51f50045c674b19a4f0ceb30702a8ab495623be7c02e07ab226f08/687474703a2f2f6564656e2e6f70656e6f766174652e636f6d2f6173736574732f696d616765732f636c6f75642d736f6369616c2e706e67) Eden Cookie
=================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#-eden-cookie)

[![Build Status](https://camo.githubusercontent.com/b10b7144c1ee2eb72b95ce25797e2d32ab07b0b136bfc4c24f5bfb1a94829648/68747470733a2f2f6170692e7472617669732d63692e6f72672f4564656e2d5048502f436f6f6b69652e706e67)](https://travis-ci.org/Eden-PHP/Cookie)
========================================================================================================================================================================================================================================================

[](#)

- [Install](#install)
- [Introduction](#intro)
- [API](#api)
    - [clear](#clear)
    - [get](#get)
    - [remove](#remove)
    - [set](#set)
    - [setData](#setData)
    - [setSecure](#setSecure)
    - [setSecureData](#setSecureData)
- [Contributing](#contributing)

====

Install
-------

[](#install)

`composer install eden/cookie`

====

Introduction
------------

[](#introduction)

Instantiate cookies in this manner.

```
$cookie = eden('cookie');

```

The cookie is returned is an array object and can be used like a normal array.

```
$cookie['me']    = array('name' => 'John', 'age' => 31);
$cookie['you']    = array('name' => 'Jane', 'age' => 28);
$cookie['him']    = array('name' => 'Jack', 'age' => 35);

foreach($cookie as $key => $value) {
	echo $value['name'];
}

```

====

API
---

[](#api)

====

### clear

[](#clear)

Removes all cookies.

#### Usage

[](#usage)

```
eden('cookie')->clear();

```

#### Parameters

[](#parameters)

Returns `Eden\Cookie\Index`

====

### get

[](#get)

Returns data

#### Usage

[](#usage-1)

```
eden('cookie')->get(*string|null $key);

```

#### Parameters

[](#parameters-1)

- `*string|null $key` - The key to retreive

Returns `mixed`

#### Example

[](#example)

```
eden('cookie')->get('foo');

```

====

### remove

[](#remove)

Removes a cookie.

#### Usage

[](#usage-2)

```
eden('cookie')->remove(*string $name);

```

#### Parameters

[](#parameters-2)

- `*string $name` - The cookie name

Returns `Eden\Cookie\Index`

#### Example

[](#example-1)

```
eden('cookie')->remove('foo');

```

====

### set

[](#set)

Sets a cookie.

#### Usage

[](#usage-3)

```
eden('cookie')->set(*string $key, scalar $data, int $expires, string $path, string|null $domain, bool $secure, bool $httponly);

```

#### Parameters

[](#parameters-3)

- `*string $key` - Cookie name
- `scalar $data` - The data
- `int $expires` - Expiration
- `string $path` - Path to make the cookie available
- `string|null $domain` - The domain
- `bool $secure` - Use secure cookie
- `bool $httponly` - Make it only available on http://

Returns `Eden\Cookie\Index`

#### Example

[](#example-2)

```
eden('cookie')->set('foo');

```

====

### setData

[](#setdata)

Sets a set of cookies.

#### Usage

[](#usage-4)

```
eden('cookie')->setData(*array $data, int $expires, string $path, string|null $domain, bool $secure, bool $httponly);

```

#### Parameters

[](#parameters-4)

- `*array $data` - The list of cookie data
- `int $expires` - Expiration
- `string $path` - Path to make the cookie available
- `string|null $domain` - The domain
- `bool $secure` - Use secure cookie
- `bool $httponly` - Make it only available on http://

Returns `Eden\Cookie\Index`

#### Example

[](#example-3)

```
eden('cookie')->setData(array('foo' => 'bar'));

```

====

### setSecure

[](#setsecure)

Sets a secure cookie.

#### Usage

[](#usage-5)

```
eden('cookie')->setSecure(*string $key, scalar $data, int $expires, string $path, string|null $domain);

```

#### Parameters

[](#parameters-5)

- `*string $key` - Cookie name
- `scalar $data` - The data
- `int $expires` - Expiration
- `string $path` - Path to make the cookie available
- `string|null $domain` - The domain

Returns `Eden\Cookie\Index`

#### Example

[](#example-4)

```
eden('cookie')->setSecure('foo');

```

====

### setSecureData

[](#setsecuredata)

Sets a set of secure cookies.

#### Usage

[](#usage-6)

```
eden('cookie')->setSecureData(*array $data, int $expires, string $path, string|null $domain);

```

#### Parameters

[](#parameters-6)

- `*array $data` - The list of cookie data
- `int $expires` - Expiration
- `string $path` - Path to make the cookie available
- `string|null $domain` - The domain

Returns `Eden\Cookie\Index`

#### Example

[](#example-5)

```
eden('cookie')->setSecureData(array('foo' => 'bar'));

```

====

\#Contributing to Eden

Contributions to *Eden* are following the Github work flow. Please read up before contributing.

\##Setting up your machine with the Eden repository and your fork

1. Fork the repository
2. Fire up your local terminal create a new branch from the `v4` branch of your fork with a branch name describing what your changes are. Possible branch name types:
    - bugfix
    - feature
    - improvement
3. Make your changes. Always make sure to sign-off (-s) on all commits made (git commit -s -m "Commit message")

\##Making pull requests

1. Please ensure to run `phpunit` before making a pull request.
2. Push your code to your remote forked version.
3. Go back to your forked version on GitHub and submit a pull request.
4. An Eden developer will review your code and merge it in when it has been classified as suitable.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

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

Total

4

Last Release

3885d ago

Major Versions

3.0.0 → 4.0.02015-10-09

PHP version history (2 changes)3.0.0PHP &gt;=5.3.1

4.0.1PHP &gt;=5.4.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/120378?v=4)[Christian Blanquera](/maintainers/cblanquera)[@cblanquera](https://github.com/cblanquera)

---

Tags

libraryeden

### Embed Badge

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

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

###  Alternatives

[league/iso3166

ISO 3166-1 PHP Library

69938.4M141](/packages/league-iso3166)[dekor/php-array-table

PHP Library for printing associative arrays as text table (similar to mysql terminal console)

347.8M3](/packages/dekor-php-array-table)[eden/core

Eden Core component full of secret sauce

15420.8k34](/packages/eden-core)

PHPackages © 2026

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