function CookieJar::fromArray
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:
File
-
vendor/
guzzlehttp/ guzzle/ src/ Cookie/ CookieJar.php, line 48
Class
- CookieJar
- Cookie jar that stores cookies as an array
Namespace
GuzzleHttp\CookieCode
public static function fromArray(array $cookies, string $domain) : self {
$cookieJar = new self();
foreach ($cookies as $name => $value) {
$cookieJar->setCookie(new SetCookie([
'Domain' => $domain,
'Name' => $name,
'Value' => $value,
'Discard' => true,
]));
}
return $cookieJar;
}