FyreCookie is a free, open-source cookie library for PHP.
Using Composer
composer require fyre/cookie
In PHP:
use Fyre\Http\Cookie;$nameis a string representing the cookie name.$valueis a string representing the cookie value.$optionsis an array containing cookie options.expiresis a number representing the cookie lifetime, and will default to null.domainis a string representing the cookie domain, and will default to "".pathis a string representing the cookie path, and will default to "/".secureis a boolean indicating whether to set a secure cookie, and will default to false.httpOnlyis a boolean indicating whether to the cookie should be HTTP only, and will default to false.sameSiteis a string representing the cookie same site, and will default to "Lax".
$cookie = new Cookie($name, $value, $options);Get Domain
Get the cookie domain.
$domain = $cookie->getDomain();Get Expires
Get the cookie expires timestamp.
$expires = $cookie->getExpires();Get Name
Get the cookie name.
$name = $cookie->getName();Get Path
Get the cookie path.
$path = $cookie->getPath();Get Same Site
Get the cookie same site attribute.
$sameSite = $cookie->getSameSite();Get Value
Get the cookie value.
$value = $cookie->getValue();Is Expired
Determine whether the cookie has expired.
$expired = $cookie->isExpired();Is Http Only
Determine whether the cookie is HTTP only.
$httpOnly = $cookie->isHttpOnly();Is Secure
Determine whether the cookie is secure.
$secure = $cookie->isSecure();