Cookie
Cookie provides a small encrypted wrapper around PHP cookies.
Use it when you want to read and write cookie values through Quantum instead of working with raw $_COOKIE and setcookie(...) calls.
What it provides
Quantum\Cookie\Cookiestorage wrappercookie()helper as the standard entry point- automatic encryption on write and decryption on read
Quick example
cookie()->set('theme', 'dark', 3600, '/', '', true, true);
if (cookie()->has('theme')) {
$theme = cookie()->get('theme');
}
cookie()->delete('theme');
Operational constraints
- values are encrypted before they are written and decrypted when they are read
set()stores the value in the current request storage immediately and also sends aSet-Cookieheadertimeis treated as seconds from now;0creates a session cookiehas()treats empty values as missing, so'',0,'0',false, andnulldo not count as presentget()depends onhas(), so those values come back asnull