| Methods |
public
|
withCookieHeader(RequestInterface $request): RequestInterface
Create a request with added cookie headers.
Create a request with added cookie headers.
If no matching cookies are found in the cookie jar, then no Cookie
header is added to the request and the same request is returned.
Parameters
| $request |
Request object to modify.
|
Returns
returns the modified request.
|
#
|
public
|
extractCookies(RequestInterface $request, ResponseInterface $response): void
Extract cookies from an HTTP response and store them in the CookieJar.
Extract cookies from an HTTP response and store them in the CookieJar.
Parameters
| $request |
Request that was sent
|
| $response |
Response that was received
|
|
#
|
public
|
setCookie(SetCookie $cookie): bool
Sets a cookie in the cookie jar.
Sets a cookie in the cookie jar.
Parameters
Returns
Returns true on success or false on failure
|
#
|
public
|
clear(string|null $domain = null, string|null $path = null, string|null $name = null): void
Remove cookies currently held in the cookie jar.
Remove cookies currently held in the cookie jar.
Invoking this method without arguments will empty the whole cookie jar.
If given a $domain argument only cookies belonging to that domain will
be removed. If given a $domain and $path argument, cookies belonging to
the specified path within that domain are removed. If given all three
arguments, then the cookie with the specified name, path and domain is
removed.
Parameters
| $domain |
Clears cookies matching a domain
|
| $path |
Clears cookies matching a domain and path
|
| $name |
Clears cookies matching a domain, path, and name
|
|
#
|
public
|
clearSessionCookies(): void
Discard all sessions cookies.
Discard all sessions cookies.
Removes cookies that don't have an expire field or a have a discard
field set to true. To be called when the user agent shuts down according
to RFC 2965.
|
#
|
public
|
toArray(): array
Converts the cookie jar to an array.
Converts the cookie jar to an array.
|
#
|