Documentation

CurlFactory
in package
implements CurlFactoryInterface

Creates curl resources from a request

Tags
final

Interfaces, Classes, Traits and Enums

CurlFactoryInterface

Table of Contents

CURL_VERSION_STR  = 'curl_version'
LOW_CURL_VERSION_NUMBER  = '7.21.2'
$handles  : array<string|int, resource>|array<string|int, CurlHandle>
$maxHandles  : int
__construct()  : mixed
create()  : EasyHandle
Creates a cURL handle resource.
finish()  : PromiseInterface
Completes a cURL transaction, either returning a response promise or a rejected promise.
release()  : void
Release an easy handle, allowing it to be reused or closed.
applyBody()  : void
applyHandlerOptions()  : void
applyHeaders()  : void
applyMethod()  : void
createHeaderFn()  : callable
createRejection()  : PromiseInterface
finishError()  : PromiseInterface
getDefaultConf()  : array<int|string, mixed>
invokeStats()  : void
removeHeader()  : void
Remove a header from the options array.
retryFailedRewind()  : PromiseInterface
This function ensures that a response was set on a transaction. If one was not set, then the request is retried if possible. This error typically means you are sending a payload, curl encountered a "Connection died, retrying a fresh connect" error, tried to rewind the stream, and then encountered a "necessary data rewind wasn't possible" error, causing the request to be sent through curl_multi_info_read() without an error status.

Constants

CURL_VERSION_STR

public mixed CURL_VERSION_STR = 'curl_version'

LOW_CURL_VERSION_NUMBER

public mixed LOW_CURL_VERSION_NUMBER = '7.21.2'
Tags
deprecated

Properties

$handles

private array<string|int, resource>|array<string|int, CurlHandle> $handles = []

$maxHandles

private int $maxHandles

Total number of idle handles to keep in cache

Methods

__construct()

public __construct(int $maxHandles) : mixed
Parameters
$maxHandles : int

Maximum number of idle handles.

Return values
mixed

create()

Creates a cURL handle resource.

public create(RequestInterface $request, array<string|int, mixed> $options) : EasyHandle
Parameters
$request : RequestInterface

Request

$options : array<string|int, mixed>

Transfer options

Return values
EasyHandle

release()

Release an easy handle, allowing it to be reused or closed.

public release(EasyHandle $easy) : void

This function must call unset on the easy handle's "handle" property.

Parameters
$easy : EasyHandle
Return values
void

applyBody()

private applyBody(RequestInterface $request, array<string|int, mixed> $options, array<string|int, mixed> &$conf) : void
Parameters
$request : RequestInterface
$options : array<string|int, mixed>
$conf : array<string|int, mixed>
Return values
void

applyHandlerOptions()

private applyHandlerOptions(EasyHandle $easy, array<string|int, mixed> &$conf) : void
Parameters
$easy : EasyHandle
$conf : array<string|int, mixed>
Return values
void

applyHeaders()

private applyHeaders(EasyHandle $easy, array<string|int, mixed> &$conf) : void
Parameters
$easy : EasyHandle
$conf : array<string|int, mixed>
Return values
void

applyMethod()

private applyMethod(EasyHandle $easy, array<string|int, mixed> &$conf) : void
Parameters
$easy : EasyHandle
$conf : array<string|int, mixed>
Return values
void

createHeaderFn()

private createHeaderFn(EasyHandle $easy) : callable
Parameters
$easy : EasyHandle
Return values
callable

createRejection()

private static createRejection(EasyHandle $easy, array<string|int, mixed> $ctx) : PromiseInterface
Parameters
$easy : EasyHandle
$ctx : array<string|int, mixed>
Return values
PromiseInterface

getDefaultConf()

private getDefaultConf(EasyHandle $easy) : array<int|string, mixed>
Parameters
$easy : EasyHandle
Return values
array<int|string, mixed>

invokeStats()

private static invokeStats(EasyHandle $easy) : void
Parameters
$easy : EasyHandle
Return values
void

removeHeader()

Remove a header from the options array.

private removeHeader(string $name, array<string|int, mixed> &$options) : void
Parameters
$name : string

Case-insensitive header to remove

$options : array<string|int, mixed>

Array of options to modify

Return values
void

retryFailedRewind()

This function ensures that a response was set on a transaction. If one was not set, then the request is retried if possible. This error typically means you are sending a payload, curl encountered a "Connection died, retrying a fresh connect" error, tried to rewind the stream, and then encountered a "necessary data rewind wasn't possible" error, causing the request to be sent through curl_multi_info_read() without an error status.

private static retryFailedRewind(callable $handler, EasyHandle $easy, array<string|int, mixed> $ctx) : PromiseInterface
Parameters
$handler : callable
$easy : EasyHandle
$ctx : array<string|int, mixed>
Return values
PromiseInterface

Search results