thelevti/onfido-api-php-client

This package is abandoned and no longer maintained. The author suggests using the https://github.com/onfido/api-php-client package instead.

The Onfido API is used to submit check requests.

5.0.4 2020-09-17 16:24 UTC

This package is auto-updated.

Last update: 2022-11-05 13:39:04 UTC


README

The Onfido API is used to submit check requests.

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 3.0.0
  • Package version: 5.0.2
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen

Requirements

PHP 7.1 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/onfido/api-php-client.git"
    }
  ],
  "require": {
    "onfido/api-php-client": "^5.0.2"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/onfido-php/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: Token
$config = Onfido\Configuration::getDefaultConfiguration();
$config->setApiKey('Authorization', 'token=' . 'YOUR API KEY');
$config->setApiKeyPrefix('Authorization', 'Token');

// Limit the at-rest region, if needed (optional, see https://documentation.onfido.com/#regions)
// $config->setHost($config->getHostFromSettings(1, array("region" => "us")));

$apiInstance = new Onfido\Api\DefaultApi(null, $config);

// Setting applicant details

$applicantDetails = new Onfido\Model\Applicant();

$applicantDetails->setFirstName('Jane');
$applicantDetails->setLastName('Doe');
$applicantDetails->setDob('1990-01-31');

$address = new \Onfido\Model\Address();
$address->setBuildingNumber('100');
$address->setStreet('Main Street');
$address->setTown('London');
$address->setPostcode('SW4 6EH');
$address->setCountry('GBR');

$applicantDetails->setAddress($address);

// Setting check details

$checkData = new Onfido\Model\Check();
$checkData->setReportNames(array('identity_standard'));

// Create an applicant and then a check with an Identity report

try {
    $applicantResult = $apiInstance->createApplicant($applicantDetails);
    $applicantId = $applicantResult->getId();
    print_r("Applicant ID: ".$applicantId);
    $checkData->setApplicantId($applicantId);
    $checkResult = $apiInstance->createCheck($checkData);
    print_r($checkResult);
} catch (Exception $e) {
    print_r($e->getResponseBody());
}

?>

Documentation for API Endpoints

All URIs are relative to https://api.onfido.com/v3

Class Method HTTP request Description
DefaultApi cancelReport POST /reports/{report_id}/cancel This endpoint is for cancelling individual paused reports.
DefaultApi createApplicant POST /applicants Create Applicant
DefaultApi createCheck POST /checks Create a check
DefaultApi createWebhook POST /webhooks Create a webhook
DefaultApi deleteWebhook DELETE /webhooks/{webhook_id} Delete a webhook
DefaultApi destroyApplicant DELETE /applicants/{applicant_id} Delete Applicant
DefaultApi downloadDocument GET /documents/{document_id}/download Download a documents raw data
DefaultApi downloadLivePhoto GET /live_photos/{live_photo_id}/download Download live photo
DefaultApi downloadLiveVideo GET /live_videos/{live_video_id}/download Download live video
DefaultApi editWebhook PUT /webhooks/{webhook_id} Edit a webhook
DefaultApi findAddresses GET /addresses/pick Search for addresses by postcode
DefaultApi findApplicant GET /applicants/{applicant_id} Retrieve Applicant
DefaultApi findCheck GET /checks/{check_id} Retrieve a Check
DefaultApi findDocument GET /documents/{document_id} A single document can be retrieved by calling this endpoint with the document’s unique identifier.
DefaultApi findLivePhoto GET /live_photos/{live_photo_id} Retrieve live photo
DefaultApi findLiveVideo GET /live_videos/{live_video_id} Retrieve live video
DefaultApi findReport GET /reports/{report_id} A single report can be retrieved using this endpoint with the corresponding unique identifier.
DefaultApi findWebhook GET /webhooks/{webhook_id} Retrieve a Webhook
DefaultApi generateSdkToken POST /sdk_token Generate a SDK token
DefaultApi listApplicants GET /applicants List Applicants
DefaultApi listChecks GET /checks Retrieve Checks
DefaultApi listDocuments GET /documents List documents
DefaultApi listLivePhotos GET /live_photos List live photos
DefaultApi listLiveVideos GET /live_videos List live videos
DefaultApi listReports GET /reports All the reports belonging to a particular check can be listed from this endpoint.
DefaultApi listWebhooks GET /webhooks List webhooks
DefaultApi restoreApplicant POST /applicants/{applicant_id}/restore Restore Applicant
DefaultApi resumeCheck POST /checks/{check_id}/resume Resume a Check
DefaultApi resumeReport POST /reports/{report_id}/resume This endpoint is for resuming individual paused reports.
DefaultApi updateApplicant PUT /applicants/{applicant_id} Update Applicant
DefaultApi uploadDocument POST /documents Upload a document
DefaultApi uploadLivePhoto POST /live_photos Upload live photo

Documentation For Models

Documentation For Authorization

Token

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Author