Using PHP Composer Package

Now, you can use iApp AI API service with PHP Composer package. It is the api client library for iApp AI API service for PHP.

Installation

$ composer require iapp-ai/iapp-php-composer

Note: This environment is using composer.

Example Usages

<?php

ini_set("include_path", "iapp-php-composer");
require_once 'iapp-php-composer/module_api.php';

################### API KEY ####################

$object = new api;

$object->apikey("XXX Your API Key XXX");

################### ID CARD OCR API ####################
// OCR on ID Card Front Side, Back Side of ID Card

$object->idcard_front("media/id-card-front.jpg");
$object->idcard_back("media/id-card-back.jpg");

// result of ID Card Front Side
$res = $object->idcard_front("media/id-card-front.jpg");
print_r($res);

// ["address"]=>string(92) "23/20 หมู่ที่ 6 ต.กะทู้ อ.กะทู้ จ.ภูเก็ต"
// ["detection_score"]=>float(0.9768817027409871)
// ["district"]=>string(15) "กะทู้"
// ["en_dob"]=>string(11) "11 Mar 1965"
// ["en_expire"]=>string(11) "10 Mar 2012"
// ["en_fname"]=>string(8) "Phensiri"
// ["en_init"]=>string(4) "Mrs."
// ["en_issue"]=>string(11) "10 Jan 2006"
// ["en_lname"]=>string(11) "Pitikorckul"
// ["en_name"]=>string(25) "Mrs Phensiri  Pitikorckul"
// ...

// result of ID Card Back Side
$res = $object->idcard_back("media/id-card-back.jpg");
print_r($res);

// object(stdClass)#7 (6) {
// ["back_number"]=>string(14) "JT0-1740123-05"
// ["back_number_status"]=>int(1)
// ["detection_score"]=>float(0.9957805077234905)
// ["error_message"]=>string(0) ""
// ["process_time"]=>float(2.3065404891967773)
// ["request_id"]=>string(43) "1dcc2bdb-bcba-43e4-810e-5ca183b44566#112804"
// }

?>

Last updated