class CookieJar

CookieJar.

Properties

protected $cookieJar

Methods

set(Cookie $cookie)

No description

Cookie|null
get(string $name, string $path = '/', string $domain = null)

Gets a cookie by name.

expire(string $name, string $path = '/', string $domain = null)

Removes a cookie by name.

clear()

Removes all the cookies from the jar.

updateFromSetCookie(array $setCookies, string $uri = null)

Updates the cookie jar from a response Set-Cookie headers.

updateFromResponse(Response $response, string $uri = null)

Updates the cookie jar from a Response object.

Cookie[]
all()

Returns not yet expired cookies.

array
allValues(string $uri, bool $returnsRawValue = false)

Returns not yet expired cookie values for the given URI.

array
allRawValues(string $uri)

Returns not yet expired raw cookie values for the given URI.

flushExpiredCookies()

Removes all expired cookies.

Details

at line 23
set(Cookie $cookie)

Parameters

Cookie $cookie

at line 42
Cookie|null get(string $name, string $path = '/', string $domain = null)

Gets a cookie by name.

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

string $name The cookie name
string $path The cookie path
string $domain The cookie domain

Return Value

Cookie|null A Cookie instance or null if the cookie does not exist

at line 76
expire(string $name, string $path = '/', string $domain = null)

Removes a cookie by name.

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

string $name The cookie name
string $path The cookie path
string $domain The cookie domain

at line 106
clear()

Removes all the cookies from the jar.

at line 117
updateFromSetCookie(array $setCookies, string $uri = null)

Updates the cookie jar from a response Set-Cookie headers.

Parameters

array $setCookies Set-Cookie headers from an HTTP response
string $uri The base URL

at line 146
updateFromResponse(Response $response, string $uri = null)

Updates the cookie jar from a Response object.

Parameters

Response $response A Response object
string $uri The base URL

at line 156
Cookie[] all()

Returns not yet expired cookies.

Return Value

Cookie[] An array of cookies

at line 180
array allValues(string $uri, bool $returnsRawValue = false)

Returns not yet expired cookie values for the given URI.

Parameters

string $uri A URI
bool $returnsRawValue Returns raw value or urldecoded value

Return Value

array An array of cookie values

at line 219
array allRawValues(string $uri)

Returns not yet expired raw cookie values for the given URI.

Parameters

string $uri A URI

Return Value

array An array of cookie values

at line 227
flushExpiredCookies()

Removes all expired cookies.