Skip to content
PHP Client Library for Onfido API
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

⚠️ This project is now obsolete and has been superseded by our new PHP API client. We recommend you migrate to use the newer client library.


onfido-php is a PHP API client for Onfido's REST API.


You can obtain onfido-php from source

$ git clone


At the beginning, You need is to import the autoload.php file, Initiate the Config, and Set the Token:


\Onfido\Config::init()->set_token('YOUR TOKEN');


The applicant endpoint supports two operations - create() and get():

Create applicant

$applicant = new \Onfido\Applicant();
$applicant->first_name = 'John';
$applicant->last_name = 'Smith';
$applicant->email = '';

$address1 = new \Onfido\Address();
$address1->postcode = 'abc';
$address1->town = 'London';
$address1->country = 'GBR';

$applicant->addresses = Array($address1);

$response = $applicant->create();

Retrieve applicant

APPLICANT_ID to be the ID of the Applicants You want to retrieve.

$applicant = (new \Onfido\Applicant())->get(APPLICANT_ID);

List applicants

->paginate(2, 5) means to get page #2 where each page has 5 Applicants, Any of both can be null to ignore

\Onfido\Config::init()->set_token('YOUR TOKEN')->paginate(2, 5);

$applicants = (new \Onfido\Applicant())->get();


The documents endpoint supports one operation - upload_for():

Upload document

$document = new \Onfido\Document();

$document->file_name = 'file.jpg';
$document->file_path = '/path/to/file.jpg';
$document->file_type = 'image/jpg';
$document->type = 'passport';
$document->side = 'front';

$response = $document->upload_for(APPLICANT_ID);


The checks endpoint supports two operations - create_for() and get():

Create check

$check = new \Onfido\Check();
$check->type = 'standard';

$report1 = new \Onfido\CheckReport();
$report1->name = 'identity';

$check->reports = Array(
$response = $check->create_for(APPLICANT_ID);

Retrieve check

$check = (new \Onfido\Check())->get(APPLICANT_ID, CHECK_ID);

List checks

\Onfido\Config::init()->set_token('YOUR TOKEN')->paginate(null, 5);

$checks = (new \Onfido\Check())->get(APPLICANT_ID);


The reports endpoint supports one operation - get():

Retrieve report

$report = (new \Onfido\Report())->get(CHECK_ID, REPORT_ID);

List reports

$report = (new \Onfido\Report())->get(CHECK_ID);

Address Picker

You can get use of the Onfido Address Picker, like:

$address = new \Onfido\AddressPicker();
$address->postcode = 'SW4 6EH';
$addresses = $address->pick();

Running tests

You will need to have latest version of phpunit installed. Then:

phpunit Applicants.php

will run the tests related to Applicant endpoint operations, and shows the results in a readable way. You can run other tests like: Checks, Documents and Reports.

You can’t perform that action at this time.