MIDDAG for Moodle

http_client_adapter implements http_client_interface

Table of Contents

Interfaces

http_client_interface
Contract for the Framework's HTTP Client.

Properties

$client  : Client
$options  : array<string|int, mixed>

Methods

__construct()  : mixed
delete()  : mixed
Perform a DELETE request.
get()  : mixed
Perform a GET request.
patch()  : mixed
Perform a PATCH request.
post()  : mixed
Perform a POST request.
post_multipart()  : mixed
put()  : mixed
Perform a PUT request.
set_authorization_bearer()  : self
Helper to set Bearer Token authorization.
set_content_type()  : self
Set the Content-Type header.
set_header()  : self
Add a custom header to the request.
request()  : mixed

Properties

Methods

__construct()

public __construct([string $base_uri = '' ]) : mixed
Parameters
$base_uri : string = ''

delete()

Perform a DELETE request.

public delete(string $uri[, array<string|int, mixed> $query = [] ]) : mixed
Parameters
$uri : string
$query : array<string|int, mixed> = []

get()

Perform a GET request.

public get(string $uri[, array<string|int, mixed> $query = [] ]) : mixed
Parameters
$uri : string

Relative or absolute URL

$query : array<string|int, mixed> = []

Query string parameters

Return values
mixed

Decoded JSON (array/object) or raw string body

patch()

Perform a PATCH request.

public patch(string $uri[, array<string|int, mixed> $data = [] ]) : mixed
Parameters
$uri : string
$data : array<string|int, mixed> = []

post()

Perform a POST request.

public post(string $uri[, array<string|int, mixed> $data = [] ][, bool $as_json = true ]) : mixed
Parameters
$uri : string
$data : array<string|int, mixed> = []

Body data

$as_json : bool = true

If true, sends as application/json. If false, as x-www-form-urlencoded.

post_multipart()

public post_multipart(string $uri[, array<string|int, mixed> $data = [] ]) : mixed
Parameters
$uri : string
$data : array<string|int, mixed> = []

put()

Perform a PUT request.

public put(string $uri[, array<string|int, mixed> $data = [] ]) : mixed
Parameters
$uri : string
$data : array<string|int, mixed> = []

set_authorization_bearer()

Helper to set Bearer Token authorization.

public set_authorization_bearer(string $token) : self
Parameters
$token : string
Return values
self

Fluent interface

set_content_type()

Set the Content-Type header.

public set_content_type(string $content_type) : self
Parameters
$content_type : string
Return values
self

Fluent interface

set_header()

Add a custom header to the request.

public set_header(string $key, string $value) : self
Parameters
$key : string
$value : string
Return values
self

Fluent interface

request()

private request(string $method, string $uri[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$method : string
$uri : string
$options : array<string|int, mixed> = []

        
On this page

Search results