Raydium Framework

HttpClient
in package

Table of Contents

$agents  : array<string|int, mixed>
$api_key  : string|null
$base_url  : string
$context  : DotAccess
$headers  : array<string|int, mixed>
$http_response  : array<string|int, mixed>
$referrer  : string|null
$stream_opts  : array<string|int, mixed>
$user_agent  : string|null
__construct()  : mixed
context()  : DotAccess
curl_request()  : mixed
get()  : array<string|int, mixed>
post()  : array<string|int, mixed>
set_referrer()  : void
set_user_agent()  : void
get_default_headers()  : array<string|int, string>
set_headers()  : void
set_http_response()  : array<string|int, mixed>
_curl()  : array<string|int, bool|mixed|string>
get_ca_bundle()  : string
is_curl_available()  : bool
parse_http_status()  : int
prepare_http_content()  : null|string
Prepare HTTP content based on method type.
request()  : array<string|int, mixed>

Properties

$agents

private array<string|int, mixed> $agents = ['moz' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36', 'chrome' => 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36', 'safari' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Safari/602.1.50']

$headers

private array<string|int, mixed> $headers

$http_response

private array<string|int, mixed> $http_response

$stream_opts

private array<string|int, mixed> $stream_opts

Methods

__construct()

public __construct(string $base_url[, array<string|int, mixed> $context = [] ]) : mixed
Parameters
$base_url : string
$context : array<string|int, mixed> = []
Return values
mixed

context()

public context() : DotAccess
Return values
DotAccess

curl_request()

public curl_request(string $endpoint[, string $method = 'GET' ][, array<string|int, mixed> $data = [] ][, array<string|int, mixed> $headers = [] ]) : mixed
Parameters
$endpoint : string
$method : string = 'GET'
$data : array<string|int, mixed> = []
$headers : array<string|int, mixed> = []
Return values
mixed

get()

public get(string $endpoint[, array<string|int, mixed> $headers = [] ]) : array<string|int, mixed>
Parameters
$endpoint : string
$headers : array<string|int, mixed> = []
Return values
array<string|int, mixed>

post()

public post(string $endpoint[, array<string|int, mixed> $data = [] ][, array<string|int, mixed> $headers = [] ]) : array<string|int, mixed>
Parameters
$endpoint : string
$data : array<string|int, mixed> = []
$headers : array<string|int, mixed> = []
Return values
array<string|int, mixed>

set_referrer()

public set_referrer(string $referrer) : void
Parameters
$referrer : string
Return values
void

set_user_agent()

public set_user_agent(string $user_agent) : void
Parameters
$user_agent : string
Return values
void

get_default_headers()

protected get_default_headers() : array<string|int, string>
Tags
psalm-return

list{0?: string}

Return values
array<string|int, string>

set_headers()

protected set_headers([array<string|int, mixed> $headers = [] ]) : void
Parameters
$headers : array<string|int, mixed> = []
Return values
void

set_http_response()

protected set_http_response(array<string|int, mixed> $http_response_header) : array<string|int, mixed>
Parameters
$http_response_header : array<string|int, mixed>
Tags
psalm-return

array<never, never>

Return values
array<string|int, mixed>

_curl()

private _curl(string $endpoint, string $method[, array<string|int, mixed> $data = [] ][, array<string|int, mixed> $headers = [] ]) : array<string|int, bool|mixed|string>
Parameters
$endpoint : string
$method : string
$data : array<string|int, mixed> = []
$headers : array<string|int, mixed> = []
Tags
psalm-return

array{status?: mixed, response?: bool|string, error?: 'curl_init not found'}

Return values
array<string|int, bool|mixed|string>

get_ca_bundle()

private get_ca_bundle() : string
Return values
string

is_curl_available()

private is_curl_available() : bool
Return values
bool

parse_http_status()

private parse_http_status(array<string|int, mixed> $http_response_header) : int
Parameters
$http_response_header : array<string|int, mixed>
Return values
int

prepare_http_content()

Prepare HTTP content based on method type.

private prepare_http_content(string $method, array<string|int, mixed> $data) : null|string
Parameters
$method : string

HTTP method.

$data : array<string|int, mixed>

Data to send in the request.

Return values
null|string

Returns the URL-encoded query string if method is 'POST'; otherwise, null.

request()

private request(string $endpoint, string $method[, array<string|int, mixed> $data = [] ][, array<string|int, mixed> $headers = [] ]) : array<string|int, mixed>
Parameters
$endpoint : string
$method : string
$data : array<string|int, mixed> = []
$headers : array<string|int, mixed> = []
Return values
array<string|int, mixed>

Search results