$cookies
$cookies : \GuzzleHttp\Cookie\SetCookie[]
Persists non-session cookies using a JSON formatted file
$cookies : \GuzzleHttp\Cookie\SetCookie[]
$strictMode : bool
$filename : string
$storeSessionCookies : bool
__construct(string $cookieFile, bool $storeSessionCookies = false) : mixed
Create a new FileCookieJar object
| string | $cookieFile | File to store the cookie data |
| bool | $storeSessionCookies | Set to true to store session cookies in the cookie jar. |
if the file cannot be found or created
shouldPersist(\GuzzleHttp\Cookie\SetCookie $cookie, bool $allowSessionCookies = false) : bool
Evaluate if this cookie should be persisted to storage that survives between requests.
| \GuzzleHttp\Cookie\SetCookie | $cookie | Being evaluated. |
| bool | $allowSessionCookies | If we should persist session cookies |
| None found |
getCookieByName(string $name) : \GuzzleHttp\Cookie\SetCookie|null
Finds and returns the cookie based on the name
| string | $name | cookie name to search for |
cookie that was found or null if not found
| None found |
| None found |
clear(mixed $domain = null, mixed $path = null, mixed $name = null) : \GuzzleHttp\Cookie\CookieJarInterface
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.
| mixed | $domain | Clears cookies matching a domain |
| mixed | $path | Clears cookies matching a domain and path |
| mixed | $name | Clears cookies matching a domain, path, and name |
| None found |
clearSessionCookies() : mixed
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.
| None found |
setCookie(\GuzzleHttp\Cookie\SetCookie $cookie) : bool
Sets a cookie in the cookie jar.
| \GuzzleHttp\Cookie\SetCookie | $cookie | Cookie to set. |
Returns true on success or false on failure
| None found |
| None found |
| None found |
extractCookies(\Psr\Http\Message\RequestInterface $request, \Psr\Http\Message\ResponseInterface $response) : mixed
Extract cookies from an HTTP response and store them in the CookieJar.
| \Psr\Http\Message\RequestInterface | $request | Request that was sent |
| \Psr\Http\Message\ResponseInterface | $response | Response that was received |
| None found |
withCookieHeader(\Psr\Http\Message\RequestInterface $request) : \Psr\Http\Message\RequestInterface
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.
| \Psr\Http\Message\RequestInterface | $request | Request object to modify. |
returns the modified request.
| None found |
| None found |
save(string $filename) : mixed
Saves the cookies to a file.
| string | $filename | File to save |
if the file cannot be found or created
| None found |
load(string $filename) : mixed
Load cookies from a JSON formatted file.
Old cookies are kept unless overwritten by newly loaded ones.
| string | $filename | Cookie file to load. |
if the file cannot be loaded.
| None found |
getCookiePathFromRequest(\Psr\Http\Message\RequestInterface $request) : string
Computes cookie path following RFC 6265 section 5.1.4
| \Psr\Http\Message\RequestInterface | $request |
| None found |
removeCookieIfEmpty(\GuzzleHttp\Cookie\SetCookie $cookie) : mixed
If a cookie already exists and the server asks to set it again with a null value, the cookie must be deleted.
| \GuzzleHttp\Cookie\SetCookie | $cookie |
| None found |