CookieJar
in package
CookieJar.
Tags
Table of Contents
Properties
- $cookieJar : mixed
Methods
- all() : array<string|int, Cookie>
- Returns not yet expired cookies.
- allRawValues() : array<string|int, mixed>
- Returns not yet expired raw cookie values for the given URI.
- allValues() : array<string|int, mixed>
- Returns not yet expired cookie values for the given URI.
- clear() : mixed
- Removes all the cookies from the jar.
- expire() : mixed
- Removes a cookie by name.
- flushExpiredCookies() : mixed
- Removes all expired cookies.
- get() : Cookie|null
- Gets a cookie by name.
- set() : mixed
- updateFromResponse() : mixed
- Updates the cookie jar from a Response object.
- updateFromSetCookie() : mixed
- Updates the cookie jar from a response Set-Cookie headers.
Properties
$cookieJar
protected
mixed
$cookieJar
= []
Methods
all()
Returns not yet expired cookies.
public
all() : array<string|int, Cookie>
Return values
array<string|int, Cookie> —An array of cookies
allRawValues()
Returns not yet expired raw cookie values for the given URI.
public
allRawValues(string $uri) : array<string|int, mixed>
Parameters
- $uri : string
-
A URI
Return values
array<string|int, mixed> —An array of cookie values
allValues()
Returns not yet expired cookie values for the given URI.
public
allValues(string $uri[, bool $returnsRawValue = false ]) : array<string|int, mixed>
Parameters
- $uri : string
-
A URI
- $returnsRawValue : bool = false
-
Returns raw value or urldecoded value
Return values
array<string|int, mixed> —An array of cookie values
clear()
Removes all the cookies from the jar.
public
clear() : mixed
expire()
Removes a cookie by name.
public
expire(string $name[, string $path = '/' ][, string $domain = null ]) : mixed
You should never use an empty domain, but if you do so, all cookies for the given name/path expire (this behavior ensures a BC behavior with previous versions of Symfony).
Parameters
- $name : string
-
The cookie name
- $path : string = '/'
-
The cookie path
- $domain : string = null
-
The cookie domain
flushExpiredCookies()
Removes all expired cookies.
public
flushExpiredCookies() : mixed
get()
Gets a cookie by name.
public
get(string $name[, string $path = '/' ][, string $domain = null ]) : Cookie|null
You should never use an empty domain, but if you do so, this method returns the first cookie for the given name/path (this behavior ensures a BC behavior with previous versions of Symfony).
Parameters
- $name : string
-
The cookie name
- $path : string = '/'
-
The cookie path
- $domain : string = null
-
The cookie domain
Return values
Cookie|null —A Cookie instance or null if the cookie does not exist
set()
public
set(Cookie $cookie) : mixed
Parameters
- $cookie : Cookie
updateFromResponse()
Updates the cookie jar from a Response object.
public
updateFromResponse(Response $response[, string $uri = null ]) : mixed
Parameters
- $response : Response
-
A Response object
- $uri : string = null
-
The base URL
updateFromSetCookie()
Updates the cookie jar from a response Set-Cookie headers.
public
updateFromSetCookie(array<string|int, string> $setCookies[, string $uri = null ]) : mixed
Parameters
- $setCookies : array<string|int, string>
-
Set-Cookie headers from an HTTP response
- $uri : string = null
-
The base URL