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

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

ytake/hack-cookie
=================

HHVM and Hack Cookies for facebook/hack-http-request-response-interfaces.

0.1.1(5y ago)143MITHack

Since Apr 19Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ytake/hack-cookie)[ Packagist](https://packagist.org/packages/ytake/hack-cookie)[ RSS](/packages/ytake-hack-cookie/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)Dependencies (9)Versions (3)Used By (0)

Hack Cookie
===========

[](#hack-cookie)

[![Build Status](https://camo.githubusercontent.com/4c7253fb994cfee49c31846a28e05188e04d9fa45a0f539b938a0067358e496e/68747470733a2f2f7472617669732d63692e6f72672f7974616b652f6861636b2d636f6f6b69652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ytake/hack-cookie)

Managing Cookies for [facebook/hack-http-request-response-interfaces](https://github.com/hhvm/hack-http-request-response-interfaces).

Supported Only Hack library. Required HHVM &gt;= 4.41.0

- [ytake/hungrr](https://github.com/ytake/hungrr)
- [usox/hackttp](https://github.com/usox/hackttp)

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

[](#installation)

```
$> composer require ytake/hack-cookie
```

Basic Usage
-----------

[](#basic-usage)

### Request Cookies

[](#request-cookies)

```
use type Ytake\HackCookie\Cookie;

$cookie = Cookie::create('theme', 'blue');
```

#### Get a Request Cookie

[](#get-a-request-cookie)

```
use type Ytake\HackCookie\RequestCookies;
use type Ytake\Hungrr\{Request, Uri};
use namespace HH\Lib\IO;

$request = new Request(Message\HTTPMethod::GET, new Uri('/'), IO\request_input);

$cookie = RequestCookies::get($request, 'theme');
$cookie = RequestCookies::get($request, 'theme', 'default-theme');
```

#### Set a Request Cookie

[](#set-a-request-cookie)

```
use type Ytake\HackCookie\RequestCookies;
use type Ytake\Hungrr\{Request, Uri};
use namespace HH\Lib\IO;

$request = new Request(Message\HTTPMethod::GET, new Uri('/'), IO\request_input);

$request = RequestCookies::set($request, Cookie::create('theme', 'blue'));
```

#### Modify a Request Cookie

[](#modify-a-request-cookie)

```
use type Ytake\HackCookie\{Cookie, Cookies, RequestCookies};
use type Ytake\Hungrr\{Request, Uri};
use namespace HH\Lib\IO;

$modify = (Cookie $cookie) ==> {
  return $cookie->getValue()
    |> $cookie->withValue($$);
}
$request = new Request(Message\HTTPMethod::GET, new Uri('/'), IO\request_input);
$request = RequestCookies::modify($request, 'theme', $modify);
```

### Response Cookies

[](#response-cookies)

```
use type Ytake\HackCookie\{SameSite, SetCookie};

SetCookie::create('lu')
  ->withValue('Rg3vHJZnehYLjVg7qi3bZjzg')
  ->withExpires(new \DateTime('Tue, 15-Jan-2020 21:47:38 GMT'))
  ->withMaxAge(500)
  ->withPath('/')
  ->withDomain('.example.com')
  ->withSecure(true)
  ->withHttpOnly(true)
  ->withSameSite(SameSite::LAX);
```

and more.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity47

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

Total

2

Last Release

2135d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/47817f3dd2890864096bd77ee772ec46061432f128988ca23939b0ca486d7bc3?d=identicon)[ytake](/maintainers/ytake)

---

Top Contributors

[![ytake](https://avatars.githubusercontent.com/u/4454078?v=4)](https://github.com/ytake "ytake (14 commits)")

---

Tags

cookiehackhacklanghhvmhttphttphhvmcookieshack

### Embed Badge

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

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

###  Alternatives

[nette/http

🌐 Nette Http: abstraction for HTTP request, response and session. Provides careful data sanitization and utility for URL and cookies manipulation.

48819.2M541](/packages/nette-http)[delight-im/cookie

Modern cookie management for PHP

1681.2M12](/packages/delight-im-cookie)[paragonie/cookie

Modern cookie management for PHP 7

5654.3k2](/packages/paragonie-cookie)[amphp/http-client-cookies

Automatic cookie handling for Amp's HTTP client.

14750.8k12](/packages/amphp-http-client-cookies)

PHPackages © 2026

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