liujinyong / tencent-v3-api

v1.5.1 2023-11-24 02:10 UTC

This package is auto-updated.

Last update: 2024-09-24 03:45:14 UTC


README

基于腾讯API V3版本。

安装

$ composer require liujinyong/tencent-v3-api 

配置

在使用本扩展之前,请先注册腾讯云账号,获取secretId和secretKey,并创建相应的人员库。

<?php

  require __DIR__ . '/vendor/autoload.php';

    $secretId  = "";
    $secretKey = "";
    $userHearderImg = "";
    $groupId = "";
    $pushUrl = "";
    $pullUrl = ""
    $key = "";
    //创建人员库
    $people    = new \Liujinyong\TencentV3Api\Lib\People($secretId, $secretKey);
    $res       = $people->CreatePerson("user1", "26", $userHearderImg, $groupId);
    
    //删除人员库
    $res       = $people->DeletePersonFromGroup("26", $groupId);
    
    //验证人脸
    $face = new \Liujinyong\TencentV3Api\Lib\Face($secretId, $secretKey);
    $res = $face->VerifyFace("user1", $userHearderImg);
    
    //获取直播推拉流地址
    $live = new \Liujinyong\TencentV3Api\Lib\Live($secretId,$secretKey,$pushUrl,$pullUrl);
    $res = $live->getLiveUrl("live","ceshi1",$key,"2022-04-10 17:33:00",true);
    
    //创建直播录制任务
    $res = $live->createRecordTask("luzhi",$pushUrl,"live",1649732129);
    
    
    //根据流名称查询在线人数
    $res = $live->DescribeStreamPlayInfoList("aaa");
    
    //终止直播录制任务
    $taskId = "";
    $res = $live->stopRecordTask($taskId);
    
    //创建视频审核任务
    $callBack = "";
    $bizType = "";
    $security = new \Liujinyong\TencentV3Api\Lib\Security($secretId,$secretKey);
    $res = $security->createVideoSecurityTask("bbb",$pullUrl,$bizType,$callBack);
    
    //终止视频审核任务
    $taskIdforVideo = "";
    $res = $security->cancelTask($taskIdforVideo);
    
    //名片识别接口
    $ocr = new \Liujinyong\TencentV3Api\Lib\Ocr($secretId,$secretKey);
    $res = $ocr->BusinessCardOCR($imageUrl);
    
    //文本内容安全接口
    $client = new \Liujinyong\TencentV3Api\Lib\ContentSecurity($secretId,$secretKey);
    $res = $client->check("社会主义价值观");
    
    
    //图片内容安全接口
    $client = new \Liujinyong\TencentV3Api\Lib\ImageSecurity($secretId,$secretKey);
    $res = $client->checkSync("ImageUrl","Target_id");
    
  

使用方法

1. 在config文件中添加secretId和secretKey配置项

贡献

您可以通过以下三种方式之一进行贡献

  1. 使用问题跟踪器提交bug报告。
  2. 问题跟踪器上回答问题或修复bug。
  3. 贡献新功能或更新wiki。

代码贡献流程并不非常正式。您只需确保遵循PSR-0、PSR-1和PSR-2编码规范。任何新的代码贡献都必须伴随适用的单元测试。

许可

MIT