CookiePlugin
in package
implements
EventSubscriberInterface
Adds, extracts, and persists cookies between HTTP requests
Table of Contents
Interfaces
- EventSubscriberInterface
- An EventSubscriber knows himself what events he is interested in.
Properties
Methods
- __construct() : mixed
- getCookieJar() : CookieJarInterface
- Get the cookie cookieJar
- getSubscribedEvents() : array<string|int, mixed>
- Returns an array of event names this subscriber wants to listen to.
- onRequestBeforeSend() : mixed
- Add cookies before a request is sent
- onRequestSent() : mixed
- Extract cookies from a sent request
Properties
$cookieJar
protected
CookieJarInterface
$cookieJar
Cookie cookieJar used to hold cookies
Methods
__construct()
public
__construct([CookieJarInterface $cookieJar = null ]) : mixed
Parameters
- $cookieJar : CookieJarInterface = null
-
Cookie jar used to hold cookies. Creates an ArrayCookieJar by default.
getCookieJar()
Get the cookie cookieJar
public
getCookieJar() : CookieJarInterface
Return values
CookieJarInterfacegetSubscribedEvents()
Returns an array of event names this subscriber wants to listen to.
public
static getSubscribedEvents() : array<string|int, mixed>
The array keys are event names and the value can be:
- The method name to call (priority defaults to 0)
- An array composed of the method name to call and the priority
- An array of arrays composed of the method names to call and respective priorities, or 0 if unset
For instance:
- array('eventName' => 'methodName')
- array('eventName' => array('methodName', $priority))
- array('eventName' => array(array('methodName1', $priority), array('methodName2')))
Return values
array<string|int, mixed> —The event names to listen to
onRequestBeforeSend()
Add cookies before a request is sent
public
onRequestBeforeSend(Event $event) : mixed
Parameters
- $event : Event
onRequestSent()
Extract cookies from a sent request
public
onRequestSent(Event $event) : mixed
Parameters
- $event : Event