Skip to content

This is an auto-generated client library for Onfido API v2

License

Notifications You must be signed in to change notification settings

seba-aln/api-php-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Onfido API is used to submit check requests.

This PHP package is automatically generated by the Swagger Codegen project:

  • API version: 2.0.0
  • Package version: 1.3.0
  • Build date: 2018-06-18T15:35:22.062Z
  • Build package: class io.swagger.codegen.languages.PhpClientCodegen

Requirements

PHP 5.4.0 and later

Installation & Usage

Composer

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

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

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to//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
Onfido\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'token=' . 'YOUR_API_KEY');
Onfido\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Token');

$api_instance = new Onfido\Api\DefaultApi();

// setting applicant details
$applicant = new Onfido\Models\Applicant();
$applicant->setFirstName('John');
$applicant->setLastName('Smith');
$applicant->setDob(new DateTime('1980-01-22'));
$applicant->setCountry('GBR');

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

$applicant->setAddresses(array($address));

// setting check request details
$check = new Onfido\Models\CheckCreationRequest();
$check->setType('express');

$report = new Onfido\Models\Report();
$report->setName('identity');

$check->setReports(array($report));

try {
    $result = $api_instance->createApplicant($applicant);
    $applicant_id = $result->getId();
    $result = $api_instance->createCheck($applicant_id, $check);
    print_r($result);
} catch (Exception $e) {
    print_r($e->getResponseBody());
}

?>

Documentation for API Endpoints

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

Class Method HTTP request Description
DefaultApi cancelReport POST /checks/{check_id}/reports/{report_id}/cancel This endpoint is for cancelling individual paused reports.
DefaultApi createApplicant POST /applicants Create Applicant
DefaultApi createCheck POST /applicants/{applicant_id}/checks Create a check
DefaultApi createWebhook POST /webhooks Create a webhook
DefaultApi destroyApplicant DELETE /applicants/{applicant_id} Delete Applicant
DefaultApi downloadDocument GET /applicants/{applicant_id}/documents/{document_id}/download Download a documents raw data
DefaultApi downloadLivePhoto GET /live_photos/{live_photo_id}/download Download live photo
DefaultApi findAddresses GET /addresses/pick Search for addresses by postcode
DefaultApi findApplicant GET /applicants/{applicant_id} Retrieve Applicant
DefaultApi findCheck GET /applicants/{applicant_id}/checks/{check_id} Retrieve a Check
DefaultApi findDocument GET /applicants/{applicant_id}/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 findReport GET /checks/{check_id}/reports/{report_id} A single report can be retrieved using this endpoint with the corresponding unique identifier.
DefaultApi findReportTypeGroup GET /report_type_groups/{report_type_group_id} Retrieve single report type group object
DefaultApi findWebhook GET /webhooks/{webhook_id} Retrieve a Webhook
DefaultApi listApplicants GET /applicants List Applicants
DefaultApi listChecks GET /applicants/{applicant_id}/checks Retrieve Checks
DefaultApi listDocuments GET /applicants/{applicant_id}/documents List documents
DefaultApi listLivePhotos GET /live_photos List live photos
DefaultApi listReportTypeGroups GET /report_type_groups Retrieve all report type groups
DefaultApi listReports GET /checks/{check_id}/reports All the reports belonging to a particular check can be listed from this endpoint.
DefaultApi listWebhooks GET /webhooks List webhooks
DefaultApi resumeCheck POST /checks/{check_id}/resume Resume a Check
DefaultApi resumeReport POST /checks/{check_id}/reports/{report_id}/resume This endpoint is for resuming individual paused reports.
DefaultApi updateApplicant PUT /applicants/{applicant_id} Update Applicant
DefaultApi uploadDocument POST /applicants/{applicant_id}/documents Upload a document
DefaultApi uploadLivePhoto POST /live_photos Upload live photo

Documentation For Models

About

This is an auto-generated client library for Onfido API v2

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 99.6%
  • Shell 0.4%