|
| __construct (string $cookieFile, bool $storeSessionCookies=false) |
| Create a new FileCookieJar object.
|
|
| __destruct () |
| Saves the file when shutting down.
|
|
| clear (string $domain=null, string $path=null, string $name=null) |
| Remove cookies currently held in the cookie jar.
|
|
| clearSessionCookies () |
| Discard all sessions cookies.
|
|
| count () |
|
| extractCookies (RequestInterface $request, ResponseInterface $response) |
| Extract cookies from an HTTP response and store them in the CookieJar.
|
|
| getCookieByName (string $name) |
| Finds and returns the cookie based on the name.
|
|
| getIterator () |
|
| load (string $filename) |
| Load cookies from a JSON formatted file.
|
|
| save (string $filename) |
| Saves the cookies to a file.
|
|
| setCookie (SetCookie $cookie) |
| Sets a cookie in the cookie jar.
|
|
| toArray () |
| Converts the cookie jar to an array.
|
|
| withCookieHeader (RequestInterface $request) |
| Create a request with added cookie headers.
|
|
|
static | fromArray (array $cookies, string $domain) |
| Create a new Cookie jar from an associative array and domain.
|
|
static | shouldPersist (SetCookie $cookie, bool $allowSessionCookies=false) |
| Evaluate if this cookie should be persisted to storage that survives between requests.
|
|
◆ __construct()
GuzzleHttp\Cookie\FileCookieJar::__construct |
( |
string | $cookieFile, |
|
|
bool | $storeSessionCookies = false ) |
Create a new FileCookieJar object.
- Parameters
-
string | $cookieFile | File to store the cookie data |
bool | $storeSessionCookies | Set to true to store session cookies in the cookie jar. |
- Exceptions
-
RuntimeException | if the file cannot be found or created |
◆ clear()
GuzzleHttp\Cookie\CookieJar::clear |
( |
string | $domain = null, |
|
|
string | $path = null, |
|
|
string | $name = null ) |
|
inherited |
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
-
string | null | $domain | Clears cookies matching a domain |
string | null | $path | Clears cookies matching a domain and path |
string | null | $name | Clears cookies matching a domain, path, and name |
Implements GuzzleHttp\Cookie\CookieJarInterface.
◆ clearSessionCookies()
GuzzleHttp\Cookie\CookieJar::clearSessionCookies |
( |
| ) |
|
|
inherited |
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.
Implements GuzzleHttp\Cookie\CookieJarInterface.
◆ extractCookies()
Extract cookies from an HTTP response and store them in the CookieJar.
- Parameters
-
RequestInterface | $request | Request that was sent |
ResponseInterface | $response | Response that was received |
Implements GuzzleHttp\Cookie\CookieJarInterface.
◆ fromArray()
static GuzzleHttp\Cookie\CookieJar::fromArray |
( |
array | $cookies, |
|
|
string | $domain ) |
|
staticinherited |
Create a new Cookie jar from an associative array and domain.
- Parameters
-
array | $cookies | Cookies to create the jar from |
string | $domain | Domain to set the cookies to |
◆ getCookieByName()
GuzzleHttp\Cookie\CookieJar::getCookieByName |
( |
string | $name | ) |
|
|
inherited |
Finds and returns the cookie based on the name.
- Parameters
-
string | $name | cookie name to search for |
- Return values
-
SetCookie|null | cookie that was found or null if not found |
◆ getIterator()
GuzzleHttp\Cookie\CookieJar::getIterator |
( |
| ) |
|
|
inherited |
- Return values
-
ArrayIterator<int,SetCookie> | |
◆ load()
GuzzleHttp\Cookie\FileCookieJar::load |
( |
string | $filename | ) |
|
Load cookies from a JSON formatted file.
Old cookies are kept unless overwritten by newly loaded ones.
- Parameters
-
string | $filename | Cookie file to load. |
- Exceptions
-
RuntimeException | if the file cannot be loaded. |
◆ save()
GuzzleHttp\Cookie\FileCookieJar::save |
( |
string | $filename | ) |
|
Saves the cookies to a file.
- Parameters
-
string | $filename | File to save |
- Exceptions
-
RuntimeException | if the file cannot be found or created |
◆ setCookie()
GuzzleHttp\Cookie\CookieJar::setCookie |
( |
SetCookie | $cookie | ) |
|
|
inherited |
Sets a cookie in the cookie jar.
- Parameters
-
SetCookie | $cookie | Cookie to set. |
- Return values
-
bool | Returns true on success or false on failure |
Implements GuzzleHttp\Cookie\CookieJarInterface.
◆ shouldPersist()
static GuzzleHttp\Cookie\CookieJar::shouldPersist |
( |
SetCookie | $cookie, |
|
|
bool | $allowSessionCookies = false ) |
|
staticinherited |
Evaluate if this cookie should be persisted to storage that survives between requests.
- Parameters
-
SetCookie | $cookie | Being evaluated. |
bool | $allowSessionCookies | If we should persist session cookies |
◆ toArray()
GuzzleHttp\Cookie\CookieJar::toArray |
( |
| ) |
|
|
inherited |
◆ withCookieHeader()
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
-
RequestInterface | $request | Request object to modify. |
- Return values
-
RequestInterface | returns the modified request. |
Implements GuzzleHttp\Cookie\CookieJarInterface.
The documentation for this class was generated from the following file:
- lib/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php