Skip to content
docsv0.2.0

HttpTransportInterface

The two HTTP calls every OAuth 2.0 authorization-code flow makes: POST the code to the token endpoint, GET the profile with the token that comes back. It exists as a seam. Every provider in this package used to call `curl_*` inline, which meant the half of each one that matters — how a token error is told apart from a transport error, what a half-filled profile does, which field stands in when the optional one is absent — could not be exercised without talking to GitHub, Google, Apple and the rest for real.

HttpTransportInterface::post()

abstract public function post(string $url, array $fields, array $headers = []): array

POSTs `$fields` as `application/x-www-form-urlencoded`.

Parameters

Parameters of post()
NameTypeDescription
$urlstring
$fieldsarray<string, string>
$headerslist<string>In `Name: value` form.

Returns

`status` is 0 when the request could not be made at all.

HttpTransportInterface::get()

abstract public function get(string $url, array $headers = []): array

GETs `$url`, typically the profile endpoint with the token in a header.

Parameters

Parameters of get()
NameTypeDescription
$urlstring
$headerslist<string>In `Name: value` form.

Returns

`status` is 0 when the request could not be made at all.