Aplus Framework Docs

Client
in package

Class Client.

Tags
see
https://www.php.net/manual/en/function.curl-setopt.php
see
https://curl.se/libcurl/c/curl_easy_setopt.html
see
https://php.watch/articles/php-curl-security-hardening

Table of Contents

$parsed  : array<string|int, mixed>
createRequest()  : Request
Create a new Request instance.
run()  : Response
Run the Request.
runMulti()  : Generator<string|int, \Framework\HTTP\Client\Response|\Framework\HTTP\Client\ResponseError>
Run multiple HTTP Requests.
parseHeaderLine()  : int
Parses Header line.

Properties

$parsed

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

Methods

createRequest()

Create a new Request instance.

public createRequest(URL|string $url) : Request
Parameters
$url : URL|string
Return values
Request

run()

Run the Request.

public run(Request $request) : Response
Parameters
$request : Request
Tags
throws
InvalidArgumentException

for invalid Request Protocol

throws
RequestException

for curl error

Return values
Response

runMulti()

Run multiple HTTP Requests.

public runMulti(array<string|int, Request$requests) : Generator<string|int, \Framework\HTTP\Client\Response|\Framework\HTTP\Client\ResponseError>
Parameters
$requests : array<string|int, Request>

An associative array of Request instances with ids as keys

Return values
Generator<string|int, \Framework\HTTP\Client\Response|\Framework\HTTP\Client\ResponseError>

The Requests ids as keys and its respective Response or ResponseError as values

parseHeaderLine()

Parses Header line.

protected parseHeaderLine(CurlHandle $curlHandle, string $line) : int
Parameters
$curlHandle : CurlHandle
$line : string
Return values
int

Search results