tabscanner/phpsdk

安装次数: 1,116

依赖者: 0

建议者: 0

安全: 0

星标: 1

关注者: 0

分支: 1

开放问题: 0

类型:package

v1.0.4 2019-04-29 10:07 UTC

This package is auto-updated.

Last update: 2024-09-29 05:21:08 UTC


README

N|Solid

世界上最先进的收据扫描API技术。

针对开发者的完美OCR收据扫描API,利用最先进的收据光学字符识别技术。专为收据识别和数据提取而设计的从头开始的技术。

Tab Scanner是全球首个真正准确的检查和收据扫描技术。它使用高度定制化的OCR系统以及最先进的AI技术,以确保以闪电般的速度进行强大而可靠的数据提取。

  • 高度准确的数据提取
  • 亚秒级处理速度
  • 跨平台API支持
  • 轻松集成到您的软件中
  • 灵活的定价方案

关于此SDK

这是Tab Scanner API的官方PHP开发套件。有关Tab Scanner API的更多信息,请访问 https://www.tabscanner.com

安装

推荐通过 Composer 安装Tab Scanner PHP SDK。

$ composer require tabscanner/phpsdk:1.0.2

基本用法

访问 Tab Scanner Admin 获取您的API密钥

注意:上传API可以接受以下参数之一

  • array - 单个HTTP文件上传变量 ($_FILES)(对于文件数组,请参阅upload_multiple方法)
  • string - 文件路径(用于fopen函数)
  • object - Laravel请求文件对象 https://laravel.net.cn/docs/5.6/requests#files
use Tabscanner\Api;

$api = new Api('ApiKeyHere');

/**
 * Upload receipt to AI server to be processed
 *
 * @param $file array|string|object
 * array - single HTTP File Upload variable ($_FILES) (for array of files see upload_multiple method)
 * string - file path (used for fopen function)
 * object - a Laravel request file object (https://laravel.net.cn/docs/5.6/requests#files)
 * 
 * @return array
 */
$file = 'receipt.jpg'; //direct grab from directory
$file2 = $_FILES['receipt']; //from upload form

$upload_response = $api->upload($file); //or $file2

//receipt token is generated from API after successful upload, else will receive error
$receipt_token = $upload_response['token'];

/**
 * Get result
 *
 * @param $token string
 * @return array - receipt data
 * - will receive status as pending or done
 * - one way to use this method is to create a loop until you get a "status done" response
 */
$result_response = $api->result($receipt_token);

即将推出

upload_multiple() //accepts multi-dimensional $_FILES