CookieJar
class CookieJar implements QueueingFactory (View source)
Traits
Properties
static protected array | $macros | The registered string macros. |
from Macroable |
protected string | $path | The default path (if specified). |
|
protected string | $domain | The default domain (if specified). |
|
protected bool|null | $secure | The default secure setting (defaults to null). |
|
protected string | $sameSite | The default SameSite option (defaults to lax). |
|
protected Cookie[] | $queued | All of the cookies queued for sending. |
Methods
Get the number of seconds until the given DateTime.
If the given value is an interval, convert it to a DateTime instance.
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Create a new cookie instance.
Create a cookie that lasts "forever" (five years).
Expire the given cookie.
Determine if a cookie has been queued.
Get a queued cookie instance.
Queue a cookie to send with the next response.
Remove a cookie from the queue.
Get the path and domain, or the default values.
Set the default path and domain for the jar.
Get the cookies which have been queued for the next request.
Details
protected int
secondsUntil(DateTimeInterface|DateInterval|int $delay)
Get the number of seconds until the given DateTime.
protected int
availableAt(DateTimeInterface|DateInterval|int $delay = 0)
Get the "available at" UNIX timestamp.
protected DateTimeInterface|int
parseDateInterval(DateTimeInterface|DateInterval|int $delay)
If the given value is an interval, convert it to a DateTime instance.
protected int
currentTime()
Get the current system time as a UNIX timestamp.
static void
macro(string $name, object|callable $macro)
Register a custom macro.
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
static bool
hasMacro(string $name)
Checks if macro is registered.
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
Cookie
make(string $name, string $value, int $minutes = 0, string|null $path = null, string|null $domain = null, bool|null $secure = null, bool $httpOnly = true, bool $raw = false, string|null $sameSite = null)
Create a new cookie instance.
Cookie
forever(string $name, string $value, string|null $path = null, string|null $domain = null, bool|null $secure = null, bool $httpOnly = true, bool $raw = false, string|null $sameSite = null)
Create a cookie that lasts "forever" (five years).
Cookie
forget(string $name, string|null $path = null, string|null $domain = null)
Expire the given cookie.
bool
hasQueued(string $key, string|null $path = null)
Determine if a cookie has been queued.
Cookie|null
queued(string $key, mixed $default = null, string|null $path = null)
Get a queued cookie instance.
void
queue(array ...$parameters)
Queue a cookie to send with the next response.
void
unqueue(string $name, string|null $path = null)
Remove a cookie from the queue.
protected array
getPathAndDomain(string $path, string $domain, bool|null $secure = null, string|null $sameSite = null)
Get the path and domain, or the default values.
$this
setDefaultPathAndDomain(string $path, string $domain, bool $secure = false, string|null $sameSite = null)
Set the default path and domain for the jar.
array
getQueuedCookies()
Get the cookies which have been queued for the next request.