kuza / verify-sdk
Verify.ke 验证 API 的封装
dev-master
2019-06-02 16:19 UTC
Requires
- php: >=5.5
- ext-json: *
- guzzlehttp/guzzle: ^6.3
Requires (Dev)
- phpunit/phpunit: 6.*
This package is auto-updated.
Last update: 2024-09-29 05:02:40 UTC
README
Verify.ke 官方 PHP 库 (https://documentation.verify.ke)
此库允许您处理 Verify.ke 提供的数据验证。
要求
- PHP >= 5.5.0
安装
composer require kuza/verify-sdk
使用方法
<?php require_once 'vendor/autoload.php'; try { $this->verifyKe = new \Kuza\Verify\Verify([ "environment" => 'sandbox', "consumer_key" => 'wertQwscvbpothdkplkjhuqswrtycvgt', "secret_key" => 'lkiutvbQaXtvcplRtbnUWspolkRfhsdu' ]); // Example 1: verify user details $data = [ "id_number" => "1234", "phone_number" => "254729941254", "first_name" => "Phelix", "surname" => "Omondi", "other_name" => "Juma", "date_of_birth" => "2019-01-01" ]; $this->verifyKe->verifyUser($data); // get the verification response $userVerificationResponse = $this->verifyKe->userIdentity->getAll(); // check if id number is verified $isIdNumberVerified = $this->verifyKe->userIdentity->isIdNumberVerified(); // Example 2: verify NCA contractor details. $data = [ "registration_no" => "46733/R/1218", "contractor_name" => "Veneers Company Limited", "category" => "NCA81", "class" => "ROAD WORK" ]; $this->verifyKe->verifyNCAContractor($data); // get all nca verification response data $ncaVerificationResponse = $this->verifyKe->ncaContractor->getAll(); // check if name is verified $isNameVerified = $this->verifyKe->ncaContractor->isNameVerified(); } catch (\Kuza\Verify\Exceptions\VerifyClientException $ex) { print $ex->getMessage(); } catch (\Kuza\Verify\Exceptions\VerifySdkException $ex) { print $ex->getMessage(); } ?>
致谢
- Phelix Juma jumaphelix@kuzalab.com