for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the overtrue/wechat.
*
* (c) overtrue <[email protected]>
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace EasyWeChat\OfficialAccount\OCR;
use EasyWeChat\Kernel\BaseClient;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
/**
* Class Client.
* @author joyeekk <[email protected]>
class Client extends BaseClient
{
* Allow image parameter type.
* @var array
protected $allowTypes = ['photo', 'scan'];
* ID card OCR.
* @param string $type
* @param string $path
* @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
public function idCard(string $type, string $path)
if (!in_array($type, $this->allowTypes, true)) {
throw new InvalidArgumentException(sprintf("Unsupported type: '%s'", $type));
}
return $this->httpGet('cv/ocr/idcard', [
'type' => $type,
'img_url' => $path,
]);
* Bank card OCR.
public function bankCard(string $path)
return $this->httpGet('cv/ocr/bankcard', [
* Vehicle license OCR.
public function vehicleLicense(string $path)
return $this->httpGet('cv/ocr/driving', [