CookiePlugin
in package
implements
Plugin
FinalYes
Handle request cookies.
Tags
Table of Contents
Interfaces
- Plugin
- A plugin is a middleware to transform the request and/or the response.
Properties
- $cookieJar : CookieJar
- Cookie storage.
Methods
- __construct() : mixed
- handleRequest() : Promise
- Handle the request and return the response coming from the next callable.
- createCookie() : Cookie|null
- Creates a cookie from a string.
- createValueKey() : array{0: string, 1: ?string}
- Separates key/value pair from cookie.
Properties
$cookieJar
Cookie storage.
private
CookieJar
$cookieJar
Methods
__construct()
public
__construct(CookieJar $cookieJar) : mixed
Parameters
- $cookieJar : CookieJar
handleRequest()
Handle the request and return the response coming from the next callable.
public
handleRequest(RequestInterface $request, callable $next, callable $first) : Promise
Parameters
- $request : RequestInterface
- $next : callable
-
Next middleware in the chain, the request is passed as the first argument
- $first : callable
-
First middleware in the chain, used to to restart a request
Return values
Promise —Resolves a PSR-7 Response or fails with an Http\Client\Exception (The same as HttpAsyncClient)
createCookie()
Creates a cookie from a string.
private
createCookie(RequestInterface $request, string $setCookieHeader) : Cookie|null
Parameters
- $request : RequestInterface
- $setCookieHeader : string
Tags
Return values
Cookie|nullcreateValueKey()
Separates key/value pair from cookie.
private
createValueKey(string $part) : array{0: string, 1: ?string}
Parameters
- $part : string
-
A single cookie value in format key=value