\GuzzleHttp\HandlerCurlMultiHandler

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.

Summary

Methods
Properties
Constants
__construct()
__get()
__destruct()
__invoke()
tick()
execute()
$_mh
No constants found
No protected methods found
No protected properties found
N/A
addRequest()
cancel()
processMessages()
timeToNext()
$factory
$selectTimeout
$active
$handles
$delays
$options
N/A

Properties

$_mh

$_mh : resource|\CurlMultiHandle

Internal use only. Lazy loaded multi-handle.

Type

CurlMultiHandle

$selectTimeout

$selectTimeout : int

Type

int

$active

$active : resource|\CurlMultiHandle|null

Type

CurlMultiHandle|null — the currently executing resource in `curl_multi_exec`.

$handles

$handles : array

Type

array — Request entry handles, indexed by handle id in `addRequest`.

$delays

$delays : array<int,float>

Type

array — An array of delay times, indexed by handle id in `addRequest`.

$options

$options : array

Type

array — An associative array of CURLMOPT_* options and corresponding values for curl_multi_setopt()

Methods

__construct()

__construct(array  $options = []) : mixed

This handler accepts the following options:

  • 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

array $options

Returns

mixed —

__get()

__get(string  $name) : resource|\CurlMultiHandle

Parameters

string $name

Throws

\BadMethodCallException

when another field as _mh will be gotten

\RuntimeException

when curl can not initialize a multi handle

Returns

resource|\CurlMultiHandle —

__destruct()

__destruct() : mixed

Returns

mixed —

__invoke()

__invoke(\Psr\Http\Message\RequestInterface  $request, array  $options) : \GuzzleHttp\Promise\PromiseInterface

Parameters

\Psr\Http\Message\RequestInterface $request
array $options

Returns

\GuzzleHttp\Promise\PromiseInterface —

tick()

tick() : void

Ticks the curl event loop.

execute()

execute() : void

Runs until all outstanding connections have completed.

addRequest()

addRequest(array  $entry) : void

Parameters

array $entry

cancel()

cancel(int  $id) : bool

Cancels a handle from sending and removes references to it.

Parameters

int $id

Handle ID to cancel and remove.

Returns

bool —

True on success, false on failure.

processMessages()

processMessages() : void

timeToNext()

timeToNext() : int

Returns

int —