chareice/laravel-real-name-verification

There is no license information available for the latest version (v0.1.2) of this package.

v0.1.2 2021-09-19 13:09 UTC

This package is auto-updated.

Last update: 2024-11-06 21:36:14 UTC


README

使用腾讯云的OCR接口对证照图片进行识别

安装方法:

composer require chareice/laravel-real-name-verification

个人实名认证

对身份证图片进行OCR识别

class User extends Model implements RealNameVerifiableContract
{
    use RealNameVerifiable;
    
    // 传入 updateRealNameData 的参数为识别到的数据
    public function updateRealNameData(RealNameData $data)
    {
        ...
    }

    // 返回用户是否已经进行了实名认证
    public function realNameVerified(): bool
    {
        ...
    }
}

$user = User::first();

// 验证成功,调用 $user 的 updateRealNameData 方法
// 验证失败,抛出异常
$user->verify($frontImageURL);

或者直接调用

app(VerifyService::class)->verifyIDCard($frontImgURL, $backImgURL);

企业营业执照认证

对营业执照图片进行OCR识别

class Company extends Model implements BizLicenseVerifiableContract
{
    use BizLicenseVerifiable;

    public function updateBizLicenseData(BizLicenseData $data)
    {
        ...
    }

    public function bizLicenseVerified(): bool
    {
        ...
    }
}

$company = Company::first();

$company->verify($licenseImgURL);

或者直接调用

app(VerifyService::class)->verifyBizLicense($licenseImgURL);