Skip to content

onfido/api-php-client

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
lib
 
 
 
 
 
 
 
 

onfido-php

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: 6.7.0
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen

Requirements

PHP 7.3 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": "^6.7.0"
  }
}

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" => "eu")));

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

// Setting applicant details

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

$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\CheckRequest();
$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.eu.onfido.com/v3.6

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 downloadCheck GET /checks/{check_id}/download Download a check raw data
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 downloadMotionCapture GET /motion_captures/{motion_capture_id}/download Download motion capture
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 findMotionCapture GET /motion_captures/{motion_capture_id} Retrieve motion capture
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 frameLiveVideo GET /live_videos/{live_video_id}/frame Download live video frame
DefaultApi frameMotionCapture GET /motion_captures/{motion_capture_id}/frame Download motion capture frame
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 listMotionCaptures GET /motion_captures List motion captures
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