ID Analyzer v2 (PHP)

Client extends Client
in package

HTTP client for the ID Analyzer v2 API.

Wraps a Guzzle client pre-configured with the regional base URI and API key authentication header. Dispatch request objects (subclasses of ApiBase) through Do().

Table of Contents

Constants

ZoneMap  : mixed = ['us' => 'https://api2.idanalyzer.com', 'eu' =>...

Properties

$apiKey  : string

Methods

__construct()  : mixed
Create a new API client.
Do()  : array<string|int, mixed>
Validate and dispatch an API request.
parseResponse()  : array<string|int, mixed>
Parse an HTTP response into a result/error tuple.

Constants

ZoneMap

public mixed ZoneMap = ['us' => 'https://api2.idanalyzer.com', 'eu' => 'https://api2-eu.idanalyzer.com']

Properties

$apiKey

protected string $apiKey

Methods

__construct()

Create a new API client.

public __construct(string $apiKey[, string $zone = 'us' ]) : mixed
Parameters
$apiKey : string

Your ID Analyzer API key, sent as the X-Api-Key header.

$zone : string = 'us'

The regional zone to target; one of us or eu. Defaults to us.

Tags
throws
SDKException

If an unknown zone is supplied.

Do()

Validate and dispatch an API request.

public Do(ApiBase $api) : array<string|int, mixed>

Validates the request object, sends it to the API using its HTTP method, resolved URI and options, then parses the response.

Parameters
$api : ApiBase

The request object to execute (e.g. QuickScan, LsTransaction).

Tags
throws
GuzzleException

If the underlying HTTP request fails at the transport level.

SDKException

If request validation fails or the response cannot be parsed.

Return values
array<string|int, mixed>

A two-element tuple [mixed $result, ApiError|null $error].

parseResponse()

Parse an HTTP response into a result/error tuple.

protected parseResponse(ResponseInterface $resp[, bool $isFile = false ]) : array<string|int, mixed>

Decodes the JSON response body. On an API-level failure (success === false) the second tuple element is an ApiError; otherwise it is null. When $isFile is true and the body is not JSON, the raw body is returned as the result.

Parameters
$resp : ResponseInterface

The HTTP response to parse.

$isFile : bool = false

Whether the response is expected to be a binary file rather than JSON. Defaults to false.

Tags
throws
SDKException

If the response body is not valid JSON and $isFile is false.

Return values
array<string|int, mixed>

A two-element tuple [mixed $result, ApiError|null $error].

On this page

Search results