worksome/laravel-onfido 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

worksome/laravel-onfido

最新稳定版本:v6.2.0

Composer 安装命令:

composer require worksome/laravel-onfido

包简介

A Laravel wrapper for the Onfido PHP client

README 文档

README

A Laravel wrapper for the Onfido PHP API Client.

Installation

Install using composer:

composer require worksome/laravel-onfido

Publish the configuration file with the following command:

php artisan vendor:publish --provider "Worksome\Onfido\OnfidoServiceProvider"

Configuration

Remember to add your Onfido API key to your .env file.

ONFIDO_API_KEY=api_sandbox.ABC...

Usage

I would always encourage anyone to use the official PHP package as reference, and this is simply a Laravel wrapper. However, I will provide an example on how to create an applicant.

Remember to import the Onfido facade, by adding use Worksome\Onfido\Facades\Onfido; at the top of your file.

To create an applicant and send a check:

use Onfido\Model\ApplicantBuilder;
use Onfido\Model\CheckBuilder;
use Worksome\Onfido\Facades\Onfido;

$applicant = Onfido::createApplicant(new ApplicantBuilder([
    'first_name' => 'John',
    'last_name' => 'Doe',
    'email' => 'johndoe@example.org',
]));

$onfidoCheck = Onfido::createCheck(new CheckBuilder([
    'applicant_id' => $applicant['id'],
    'report_names' => ['right_to_work'],
    'applicant_provides_data' => true,
]));

The above is all that is required to create an applicant and send the applicant a right to work check via Onfido.

You can then consult the results of the applicant or check:

/** @var \Onfido\Model\ApplicantResponse $applicant */
$applicant->getId();

/** @var \Onfido\Model\CheckResponse $onfidoCheck */
$onfidoCheck->getId();

// The responses can also be accessed as an arrayable.
$applicant['id'];
$onfidoCheck['id'];
$onfidoCheck['status'];
$onfidoCheck['form_uri'];

To see all possible return data check the official PHP package documentation.

统计信息

  • 总下载量: 371.4k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 6
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-05-09