Request Cookies

Get Cookies

A Yee application will automatically parse cookies sent with the current HTTP request. You can fetch cookie values with the Yee application’s getCookie() helper method like this:

$app = new \Yee\Yee();
$foo = $app->getCookie('foo');

Only Cookies sent with the current HTTP request are accessible with this method. If you set a cookie during the current request, it will not be accessible with this method until the subsequent request. Bear in mind the \Yee\Yee object's getCookie() method exists for convenience. You may also retrieve the complete set of HTTP request cookies directly from the \Yee\Http\Request object like this:

$cookies = $app->request->cookies;

This will return an instance of \Yee\Helper\Set so you can use its simple, standardized interface to inspect the request's cookies.

Cookie Encryption

You can optionally choose to encrypt all cookies stored on the HTTP client with the Yee app's cookies.encrypt setting. When this setting is true, all cookies will be encrypted using your designated secret key and cipher.

It's really that easy. Cookies will be encrypted automatically before they are sent to the client. They will also be decrypted on-demand when you request them with \Yee\Yee::getCookie() during subsequent requests.