partfire/onfido
Composer 安装命令:
composer require partfire/onfido
包简介
A composer package version of the Onfido php library.
README 文档
README
This is a PHP API client for Onfido's REST API.
We have kept this library as close to the original as possible and so can be used as the documentation states.
In order to run the tests, you must update the AbstractTest file with your api token. The tests are poor as they depend upon data on your Onfido account (e.g. customer ids).
These are the original unit tests that Onfido provided.
Installation
You can obtain onfido-php from source
$ git clone https://github.com/onfido/php-onfido.git
or you can install via composer:
$ composer require partfire/onfido
Usage
At the beginning, You need is to import the autoload.php file, Initiate the Config, and Set the Token:
require_once('autoload.php');
\Onfido\Config::init()->set_token('YOUR TOKEN');
Applicants
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 = 'email@server.com';
$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();
Documents
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);
Checks
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(
$report1
);
$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);
Reports
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.
partfire/onfido 适用场景与选型建议
partfire/onfido 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 109 次下载、GitHub Stars 达 2, 最近一次更新时间为 2016 年 11 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「onfido」 「onfido-php」 「onfido composer」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 partfire/onfido 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 partfire/onfido 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 partfire/onfido 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel wrapper for the Onfido PHP client
A Laravel wrapper for the Onfido PHP client
A library to interact with the Onfido REST API
This composer plugin enables installation of GravityForms WordPress plugin and its addons.
Simple ASCII output of array data
统计信息
- 总下载量: 109
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-11-07