http_client_interface
interface http_client_interface
Contract for the Framework's HTTP Client.
Provides a standardized, fluent interface for making HTTP requests. Implementations must handle low-level transport (Guzzle/Curl), proxy settings, and Moodle's User-Agent compliance automatically.
Methods
set_header(string $key, string $value)
Add a custom header to the request.
set_authorization_bearer(string $token)
Helper to set Bearer Token authorization.
set_content_type(string $content_type)
Set the Content-Type header.
mixed
get(string $uri, array $query = [])
Perform a GET request.
mixed
post(string $uri, array $data = [], bool $as_json = true)
Perform a POST request.
mixed
put(string $uri, array $data = [])
Perform a PUT request.
mixed
patch(string $uri, array $data = [])
Perform a PATCH request.
mixed
delete(string $uri, array $query = [])
Perform a DELETE request.
Details
at line 37
http_client_interface
set_header(string $key, string $value)
Add a custom header to the request.
at line 46
http_client_interface
set_authorization_bearer(string $token)
Helper to set Bearer Token authorization.
at line 55
http_client_interface
set_content_type(string $content_type)
Set the Content-Type header.
at line 65
mixed
get(string $uri, array $query = [])
Perform a GET request.
at line 76
mixed
post(string $uri, array $data = [], bool $as_json = true)
Perform a POST request.
at line 86
mixed
put(string $uri, array $data = [])
Perform a PUT request.
at line 96
mixed
patch(string $uri, array $data = [])
Perform a PATCH request.
at line 106
mixed
delete(string $uri, array $query = [])
Perform a DELETE request.