Documentation

CurlMultiClient
in package

Curl multi http client

Table of Contents

Properties

$counter  : int
the request counter (request ID/order in multi response handler)
$curl_multi  : CurlMultiHandle
the cURL multi handle instance
$handles  : array<string|int, mixed>
the stack of running handles
$logger  : LoggerInterface
$multiResponseHandler  : MultiResponseHandlerInterface
$options  : HTTPOptions|SettingsContainerInterface
$requests  : array<string|int, mixed>
An array of RequestInterface to run
$responseFactory  : ResponseFactoryInterface

Methods

__construct()  : mixed
CurlMultiClient constructor.
__destruct()  : mixed
close an existing cURL multi handle on exit
addRequest()  : static
adds a request to the stack
addRequests()  : static
adds multiple requests to the stack
close()  : static
closes the handle
process()  : static
processes the stack
setLogger()  : static
createHandle()  : void
creates a new request handle
initCurlMultiOptions()  : void
resolve()  : void
resolves the handle, calls the response handler callback and creates the next handle

Properties

$counter

the request counter (request ID/order in multi response handler)

protected int $counter = 0

$curl_multi

the cURL multi handle instance

protected CurlMultiHandle $curl_multi

$handles

the stack of running handles

protected array<string|int, mixed> $handles = []

cURL instance id => [counter, retries, handle]

$requests

An array of RequestInterface to run

protected array<string|int, mixed> $requests = []

$responseFactory

protected ResponseFactoryInterface $responseFactory

Methods

__construct()

CurlMultiClient constructor.

public __construct(MultiResponseHandlerInterface $multiResponseHandler, ResponseFactoryInterface $responseFactory[, HTTPOptions|SettingsContainerInterface $options = new HTTPOptions() ][, LoggerInterface $logger = new NullLogger() ]) : mixed
Parameters
$multiResponseHandler : MultiResponseHandlerInterface
$responseFactory : ResponseFactoryInterface
$options : HTTPOptions|SettingsContainerInterface = new HTTPOptions()
$logger : LoggerInterface = new NullLogger()

__destruct()

close an existing cURL multi handle on exit

public __destruct() : mixed

addRequest()

adds a request to the stack

public addRequest(RequestInterface $request) : static
Parameters
$request : RequestInterface
Return values
static

addRequests()

adds multiple requests to the stack

public addRequests(array<string|int, RequestInterface$stack) : static
Parameters
$stack : array<string|int, RequestInterface>
Return values
static

close()

closes the handle

public close() : static
Return values
static

process()

processes the stack

public process() : static
Tags
throws
ClientExceptionInterface
Return values
static

setLogger()

public setLogger(LoggerInterface $logger) : static
Parameters
$logger : LoggerInterface
Tags
inheritDoc
codeCoverageIgnore
Return values
static

createHandle()

creates a new request handle

protected createHandle([RequestInterface|null $request = null ][, int|null $counter = null ][, int|null $retries = null ]) : void
Parameters
$request : RequestInterface|null = null
$counter : int|null = null
$retries : int|null = null

resolve()

resolves the handle, calls the response handler callback and creates the next handle

protected resolve(int $handleID) : void
Parameters
$handleID : int

        
On this page

Search results