定制 idanalyzer/id-analyzer-v2-php-sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

idanalyzer/id-analyzer-v2-php-sdk

Composer 安装命令:

composer require idanalyzer/id-analyzer-v2-php-sdk

包简介

ID scanning and verification PHP SDK for worldwide driver license, passport, ID card scanning and identity verification using ID Analyzer API V2.

README 文档

README

Packagist version PHP version license

Official PHP client library for the ID Analyzer API v2 — automate identity document verification, KYC onboarding and biometric checks in minutes.

Scan and authenticate passports, driver's licenses, ID cards, visas and residence permits from 190+ countries, run 1:1 face match and liveness detection, screen against AML / PEP / sanctions watchlists, and onboard users remotely with DocuPass hosted verification & e-signature.

Features

  • Document OCR & authentication — passport, driver's license, ID card, visa & residence-permit recognition from 190+ countries, including MRZ and PDF417 / AAMVA barcode parsing.
  • Biometric verification — 1:1 face match and liveness / presentation-attack detection.
  • AML screening — PEP, sanctions, watchlist and adverse-media checks.
  • DocuPass — hosted, no-code remote identity verification, KYC/AML onboarding and legally-binding e-signature.
  • KYC profiles, transaction vault, contract generation and webhooks.
  • US & EU data-residency regions.

⚠️ Never embed your API key in client-side apps (mobile, browser JS). Call the API from your server.

Installation

composer require idanalyzer/id-analyzer-v2-php-sdk

Requires PHP 7.4+ (Guzzle 7, PSR-4).

Authentication & region

Pass the zone as the second constructor argument — "us" (default, https://api2.idanalyzer.com) or "eu" (https://api2-eu.idanalyzer.com):

$client = new IDAnalyzer2\Client("YOUR_API_KEY", "eu");

Usage

Every endpoint is a request class under IDAnalyzer2\Api\…. Set its public properties, then call $client->Do($request), which returns a [$result, $err] tuple — $result is the decoded response object and $err is an ApiError (or null). Image/document inputs accept a base64 string, a file path/URL, or a ref: cache reference from a previous scan.

require_once __DIR__.'/vendor/autoload.php';

use IDAnalyzer2\Client;
use IDAnalyzer2\Api\Scanner\StandardScan;

$client = new Client("YOUR_API_KEY");

$scan = new StandardScan();
$scan->document = base64_encode(file_get_contents('id_front.jpg'));
$scan->face     = base64_encode(file_get_contents('selfie.jpg'));   // optional biometric check
$scan->profile  = "security_medium";   // a preset, or your KYC profile ID

list($result, $err) = $client->Do($scan);
if ($err !== null) {
    echo 'API error: '.$err->message;
} else {
    echo $result->decision;   // accept / review / reject
}

Examples

Document scanning

use IDAnalyzer2\Api\Scanner\QuickScan;       // fast OCR
use IDAnalyzer2\Api\Scanner\VeryQuickScan;   // fastest OCR-only

$qs = new QuickScan();
$qs->document  = base64_encode(file_get_contents('id_front.jpg'));
$qs->documentBack = base64_encode(file_get_contents('id_back.jpg')); // optional
$qs->saveFile  = true;   // cache the image 24h and return a ref: hash
list($result, $err) = $client->Do($qs);

Biometric — face match & liveness

use IDAnalyzer2\Api\Biometric\FaceVerification;
use IDAnalyzer2\Api\Biometric\LivenessVerification;

$face = new FaceVerification();
$face->reference = base64_encode(file_get_contents('id_portrait.jpg'));
$face->face      = base64_encode(file_get_contents('selfie.jpg'));
$face->profile   = "security_medium";
list($result, $err) = $client->Do($face);

$live = new LivenessVerification();
$live->face    = base64_encode(file_get_contents('selfie.jpg'));
$live->profile = "security_medium";
list($result, $err) = $client->Do($live);

AML / PEP / sanctions screening

use IDAnalyzer2\Api\AML\AMLSearch;
use IDAnalyzer2\Api\AML\AMLV3Search;

$aml = new AMLSearch();
$aml->name    = "John Smith";
$aml->country = "US";          // optional ISO-2 filter
list($result, $err) = $client->Do($aml);          // POST /aml

$amlv3 = new AMLV3Search();
$amlv3->text  = "John Smith";
$amlv3->limit = 10;
$amlv3->page  = 1;
list($result, $err) = $client->Do($amlv3);        // POST /amlv3

KYB — business verification

Verify a business from its registration/incorporation document: extract details, check official company registries, screen against sanctions/PEP, and return directors/owners to verify. Supply a document and/or known business identifiers (at least one of document, legalName or registrationNumber).

use IDAnalyzer2\Api\KYB\KYBVerify;

// From a registration/incorporation document
$kyb = new KYBVerify();
$kyb->document = base64_encode(file_get_contents('./registration.jpg'));
list($result, $err) = $client->Do($kyb);          // POST /kyb

// Or from known business details
$kyb = new KYBVerify();
$kyb->legalName          = "ACME CORPORATION";
$kyb->registrationNumber = "12345678";
$kyb->countryIso2        = "US";                  // ISO-2 country of registration
list($result, $err) = $client->Do($kyb);          // POST /kyb

Contracts — generate & manage templates

use IDAnalyzer2\Api\Contract\GenerateContract;
use IDAnalyzer2\Api\Contract\CreateTemplate;
use IDAnalyzer2\Api\Contract\LsTemplate;
use IDAnalyzer2\Api\Contract\TemplateDetail;
use IDAnalyzer2\Api\Contract\EdTemplate;
use IDAnalyzer2\Api\Contract\RmTemplate;

// Create a template
$create = new CreateTemplate();
$create->name        = "NDA";
$create->content     = "<p>Signed by %{fullName}</p>";
$create->orientation = "0";
$create->font        = "Arial";
$create->timezone    = "UTC";
list($tpl, $err) = $client->Do($create);
$templateId = $tpl->templateId;

// Generate a document from a template + data
$gen = new GenerateContract();
$gen->templateId = $templateId;
$gen->format     = "PDF";
$gen->fillData   = ["fullName" => "Mark"];
list($doc, $err) = $client->Do($gen);

// List / detail / edit / remove
$client->Do(new LsTemplate());
$detail = new TemplateDetail();  $detail->templateId = $templateId;  $client->Do($detail);
$rm = new RmTemplate();          $rm->templateId = $templateId;      $client->Do($rm);

Transactions — history, decisions, vault & export

use IDAnalyzer2\Api\Transaction\LsTransaction;
use IDAnalyzer2\Api\Transaction\TransactionDetail;
use IDAnalyzer2\Api\Transaction\EdTransaction;
use IDAnalyzer2\Api\Transaction\RmTransaction;
use IDAnalyzer2\Api\Transaction\OutputImage;
use IDAnalyzer2\Api\Transaction\OutputFile;
use IDAnalyzer2\Api\Transaction\ExportTransaction;

// List & fetch
$client->Do(new LsTransaction());
$detail = new TransactionDetail(); $detail->transactionId = "TX_ID"; $client->Do($detail);

// Update decision / delete
$ed = new EdTransaction(); $ed->transactionId = "TX_ID"; $ed->decision = "reject"; $client->Do($ed);
$rm = new RmTransaction(); $rm->transactionId = "TX_ID"; $client->Do($rm);

// Download a vault image / file (returns raw bytes)
$oi = new OutputImage(); $oi->imageToken = "IMAGE_TOKEN";
list($bytes, $err) = $client->Do($oi);
file_put_contents("image.jpg", $bytes);

$of = new OutputFile(); $of->fileName = "audit-report.pdf";
list($bytes, $err) = $client->Do($of);
file_put_contents($of->fileName, $bytes);

// Export an archive (zip is base64 in the response)
$et = new ExportTransaction();
$et->exportType = "json";
$et->createdAtMin = (string)(time() - 86400);
$et->createdAtMax = (string)time();
list($export, $err) = $client->Do($et);
file_put_contents("export.zip", base64_decode($export->Base64));

DocuPass — hosted remote verification & e-signature

use IDAnalyzer2\Api\Docupass\CreateDocupass;
use IDAnalyzer2\Api\Docupass\LsDocupass;
use IDAnalyzer2\Api\Docupass\DocupassDetail;
use IDAnalyzer2\Api\Docupass\RmDocupass;

$create = new CreateDocupass();
$create->profile = "security_medium";   // or your KYC profile ID
$create->mode    = 0;                    // 0=Document+Face, 1=Document, 2=Face, 3=e-Signature
list($docupass, $err) = $client->Do($create);
// send the user to the returned verification URL / reference
echo $docupass->reference;

$client->Do(new LsDocupass());
$d = new DocupassDetail(); $d->reference = $docupass->reference; $client->Do($d);
$rm = new RmDocupass();    $rm->reference = $docupass->reference; $client->Do($rm);

KYC profiles

use IDAnalyzer2\Api\Profile\CreateProfile;
use IDAnalyzer2\Api\Profile\LsProfile;
use IDAnalyzer2\Api\Profile\ProfileDetail;
use IDAnalyzer2\Api\Profile\EdProfile;
use IDAnalyzer2\Api\Profile\RmProfile;
use IDAnalyzer2\Api\Profile\ExportProfile;

$create = new CreateProfile();           // optionally set name, thresholds, decisions, acceptedDocuments, webhook…
list($profile, $err) = $client->Do($create);
$profileId = $profile->id;

$client->Do(new LsProfile());
$d = new ProfileDetail(); $d->profileId = $profileId; $client->Do($d);
$rm = new RmProfile();    $rm->profileId = $profileId; $client->Do($rm);

$ex = new ExportProfile(); $ex->profileId = $profileId; $client->Do($ex);

Webhooks & account

use IDAnalyzer2\Api\Webhook\LsWebhook;
use IDAnalyzer2\Api\Webhook\ResendWebhook;
use IDAnalyzer2\Api\Webhook\RmWebhook;
use IDAnalyzer2\Api\Account\MyAccount;

$client->Do(new LsWebhook());
$resend = new ResendWebhook(); $resend->webhookId = "WEBHOOK_ID"; $client->Do($resend);
$rm = new RmWebhook();         $rm->webhookId = "WEBHOOK_ID";     $client->Do($rm);

// Account quota & usage
list($account, $err) = $client->Do(new MyAccount());

Runnable versions of every example are in the /example folder.

API reference

Group Request classes (IDAnalyzer2\Api\…) Endpoint
Scanner Scanner\StandardScan POST /scan
Scanner\QuickScan POST /quickscan
Scanner\VeryQuickScan POST /veryquickscan
Biometric Biometric\FaceVerification POST /face
Biometric\LivenessVerification POST /liveness
AML AML\AMLSearch POST /aml
AML\AMLV3Search POST /amlv3
KYB KYB\KYBVerify POST /kyb
Contract Contract\GenerateContract POST /generate
Contract\CreateTemplate / LsTemplate / TemplateDetail / EdTemplate / RmTemplate /contract
Transaction Transaction\LsTransaction / TransactionDetail / EdTransaction / RmTransaction /transaction
Transaction\ExportTransaction POST /export/transaction
Transaction\OutputImage / OutputFile /imagevault · /filevault
Docupass Docupass\CreateDocupass / LsDocupass / DocupassDetail / RmDocupass /docupass
Profile Profile\CreateProfile / LsProfile / ProfileDetail / EdProfile / RmProfile / ExportProfile /profile
Webhook Webhook\LsWebhook / ResendWebhook / RmWebhook /webhook
Account Account\MyAccount GET /myaccount

Full parameter-level reference: developer.idanalyzer.com/help/php.

Resources

Other ID Analyzer SDKs

PHP · Python · Node.js · .NET · Java · Go

License

MIT © ID Analyzer — see LICENSE.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固