Documentation

Requestor
in package

Table of Contents

$apiKey  : string
$supportEmail  : string
__construct()  : mixed
Constructor.
apiUrl()  : string
Get the API URL.
curlRequest()  : array<string|int, mixed>
Build the cURL request.
handleApiError()  : mixed
Handles API errors returned from EasyPost.
handleCurlError()  : mixed
Handle errors related to curling the API.
interpretResponse()  : mixed
Interpret the response body we receive from the API.
request()  : array<string|int, mixed>
Make a request to the EasyPost API.
urlEncode()  : string
URL Encodes data for GET requests.
utf8()  : string
Converts a set of values to UTF-8 encoding.
encodeObjects()  : array<string|int, mixed>|string
Encodes an EasyPost object and prepares the data for the request.
requestRaw()  : array<string|int, mixed>
Internal logic required to make a request to the EasyPost API.

Properties

$supportEmail

private string $supportEmail = 'support@easypost.com'

Methods

__construct()

Constructor.

public __construct([string $apiKey = null ]) : mixed
Parameters
$apiKey : string = null
Return values
mixed

apiUrl()

Get the API URL.

public static apiUrl([string $url = '' ][, mixed $beta = false ]) : string
Parameters
$url : string = ''
$beta : mixed = false
Return values
string

curlRequest()

Build the cURL request.

public curlRequest(string $method, string $absUrl, mixed $headers, mixed $params) : array<string|int, mixed>
Parameters
$method : string
$absUrl : string
$headers : mixed
$params : mixed
Tags
throws
Error
Return values
array<string|int, mixed>

handleApiError()

Handles API errors returned from EasyPost.

public handleApiError(string $httpBody, int $httpStatus, array<string|int, mixed> $response) : mixed
Parameters
$httpBody : string
$httpStatus : int
$response : array<string|int, mixed>
Tags
throws
Error
Return values
mixed

handleCurlError()

Handle errors related to curling the API.

public handleCurlError(int $errorNum, string $message) : mixed
Parameters
$errorNum : int
$message : string
Tags
throws
Error
Return values
mixed

interpretResponse()

Interpret the response body we receive from the API.

public interpretResponse(string $httpBody, int $httpStatus) : mixed
Parameters
$httpBody : string
$httpStatus : int
Tags
throws
Error
Return values
mixed

request()

Make a request to the EasyPost API.

public request(string $method, string $url[, mixed $params = null ][, mixed $apiKeyRequired = true ][, mixed $beta = false ]) : array<string|int, mixed>
Parameters
$method : string
$url : string
$params : mixed = null
$apiKeyRequired : mixed = true
$beta : mixed = false
Tags
throws
Error
Return values
array<string|int, mixed>

urlEncode()

URL Encodes data for GET requests.

public static urlEncode(mixed $arr[, null $prefix = null ]) : string
Parameters
$arr : mixed
$prefix : null = null
Return values
string

utf8()

Converts a set of values to UTF-8 encoding.

public static utf8(mixed $value) : string
Parameters
$value : mixed
Return values
string

encodeObjects()

Encodes an EasyPost object and prepares the data for the request.

private static encodeObjects(mixed $data) : array<string|int, mixed>|string
Parameters
$data : mixed
Return values
array<string|int, mixed>|string

requestRaw()

Internal logic required to make a request to the EasyPost API.

private requestRaw(string $method, string $url, mixed $params[, mixed $apiKeyRequired = true ][, mixed $beta = false ]) : array<string|int, mixed>
Parameters
$method : string
$url : string
$params : mixed
$apiKeyRequired : mixed = true
$beta : mixed = false
Tags
throws
Error
Return values
array<string|int, mixed>

Search results