CurlMultiHandler
in package
Returns an asynchronous response using curl_multi_* functions.
When using the CurlMultiHandler, custom curl options can be specified as an associative array of curl option constants mapping to values in the curl key of the provided request options.
Table of Contents
Properties
- $_mh : resource
- $active : mixed
- $delays : mixed
- $factory : CurlFactoryInterface
- $handles : mixed
- $options : mixed
- $selectTimeout : mixed
Methods
- __construct() : mixed
- This handler accepts the following options:
- __destruct() : mixed
- __get() : mixed
- __invoke() : mixed
- execute() : mixed
- Runs until all outstanding connections have completed.
- tick() : mixed
- Ticks the curl event loop.
- addRequest() : mixed
- cancel() : bool
- Cancels a handle from sending and removes references to it.
- processMessages() : mixed
- timeToNext() : mixed
Properties
$_mh
public
resource
$_mh
Internal use only. Lazy loaded multi-handle.
$active
private
mixed
$active
$delays
private
mixed
$delays
= []
$factory
private
CurlFactoryInterface
$factory
$handles
private
mixed
$handles
= []
$options
private
mixed
$options
= []
$selectTimeout
private
mixed
$selectTimeout
Methods
__construct()
This handler accepts the following options:
public
__construct([array<string|int, mixed> $options = [] ]) : mixed
- handle_factory: An optional factory used to create curl handles
- select_timeout: Optional timeout (in seconds) to block before timing out while selecting curl handles. Defaults to 1 second.
- options: An associative array of CURLMOPT_* options and corresponding values for curl_multi_setopt()
Parameters
- $options : array<string|int, mixed> = []
__destruct()
public
__destruct() : mixed
__get()
public
__get(mixed $name) : mixed
Parameters
- $name : mixed
__invoke()
public
__invoke(RequestInterface $request, array<string|int, mixed> $options) : mixed
Parameters
- $request : RequestInterface
- $options : array<string|int, mixed>
execute()
Runs until all outstanding connections have completed.
public
execute() : mixed
tick()
Ticks the curl event loop.
public
tick() : mixed
addRequest()
private
addRequest(array<string|int, mixed> $entry) : mixed
Parameters
- $entry : array<string|int, mixed>
cancel()
Cancels a handle from sending and removes references to it.
private
cancel(int $id) : bool
Parameters
- $id : int
-
Handle ID to cancel and remove.
Return values
bool —True on success, false on failure.
processMessages()
private
processMessages() : mixed
timeToNext()
private
timeToNext() : mixed