Class CodeIgniter\Cookie\Cookie

implements ArrayAccess<string, bool|int|string>, CloneableCookieInterface

A Cookie class represents an immutable HTTP cookie value object.

Being immutable, modifying one or more of its attributes will return a new Cookie instance, rather than modifying itself. Users should reassign this new instance to a new variable to capture it.

$cookie = new Cookie('test_cookie', 'test_value');
$cookie->getName(); // test_cookie

$cookie->withName('prod_cookie');
$cookie->getName(); // test_cookie

$cookie2 = $cookie->withName('prod_cookie');
$cookie2->getName(); // prod_cookie
Methods
Constants inherited from CodeIgniter\Cookie\CookieInterface
SAMESITE_NONE, SAMESITE_LAX, SAMESITE_STRICT, ALLOWED_SAMESITE_VALUES, EXPIRES_FORMAT
Properties