Cookies
Table of Contents
- $domain : string
- The default domain (if specified).
- $path : string
- The default path (if specified).
- $secure : bool
- The default secure setting (defaults to false).
- delete() : bool
- Delete the cookie.
- deleteMultiple() : void
- Delete multiple cookies.
- get() : mixed
- Get the cookie value.
- getMultiple() : array<string|int, mixed>
- Get multiple values from cookie.
- has() : bool
- Determine if cookie set or not.
- set() : bool
- Set the cookie value.
- setDefaultPathAndDomain() : object
- Set the default path and domain for the jar.
- setMultiple() : object
- Set the multiple cookies value.
- getPathAndDomain() : array<string|int, mixed>
- Get the path and domain, or the default values.
Properties
$domain
The default domain (if specified).
protected
string
$domain
Tags
$path
The default path (if specified).
protected
string
$path
= '/'
Tags
$secure
The default secure setting (defaults to false).
protected
bool
$secure
= false
Tags
Methods
delete()
Delete the cookie.
public
delete((string) $name[, mixed $path = null ][, mixed $domain = null ]) : bool
Parameters
- $name : (string)
-
of cookie
- $path : mixed = null
- $domain : mixed = null
Tags
Return values
bool —deleteMultiple()
Delete multiple cookies.
public
deleteMultiple((array) $keys) : void
Parameters
- $keys : (array)
-
keys
Tags
Return values
void —get()
Get the cookie value.
public
get((\alphaz\Cookies\sring) $name[, (mixed) $default = null ]) : mixed
Parameters
- $name : (\alphaz\Cookies\sring)
-
of cookie
- $default : (mixed) = null
-
default value if cookie is not exists
Tags
Return values
mixed —getMultiple()
Get multiple values from cookie.
public
getMultiple((array) $keys[, (mixed) $default = null ]) : array<string|int, mixed>
Parameters
- $keys : (array)
-
name
- $default : (mixed) = null
-
default value if cookie is not exists
Tags
Return values
array<string|int, mixed> —has()
Determine if cookie set or not.
public
has((string) $name) : bool
Parameters
- $name : (string)
-
of cookie
Tags
Return values
bool —set()
Set the cookie value.
public
set((string) $name, (mixed) $value, (\alphaz\Cookies\expire) $expire[, (string) $path = null ][, (\alphaz\Cookies\domain) $domain = null ][, (bool) $secure = false ][, (bool) $httponly = true ]) : bool
Parameters
- $name : (string)
-
Name of cookie.
- $value : (mixed)
-
Value to store in cookie.
- $expire : (\alphaz\Cookies\expire)
-
TTL.
- $path : (string) = null
-
Path.
- $domain : (\alphaz\Cookies\domain) = null
-
Domain.
- $secure : (bool) = false
-
true | false.
- $httponly : (bool) = true
-
true | false.
Tags
Return values
bool —setDefaultPathAndDomain()
Set the default path and domain for the jar.
public
setDefaultPathAndDomain(string $path, string $domain[, bool $secure = false ][, mixed $sameSite = null ]) : object
Parameters
- $path : string
- $domain : string
- $secure : bool = false
- $sameSite : mixed = null
Tags
Return values
object —setMultiple()
Set the multiple cookies value.
public
setMultiple((array) $array) : object
Parameters
- $array : (array)
-
valid array.
Tags
Return values
object —getPathAndDomain()
Get the path and domain, or the default values.
protected
getPathAndDomain(string $path, string $domain[, bool $secure = false ][, mixed $sameSite = null ]) : array<string|int, mixed>
Parameters
- $path : string
- $domain : string
- $secure : bool = false
- $sameSite : mixed = null