liujinyong / tencent-v3-api
base on tencent-api V3 version
v1.5.1
2023-11-24 02:10 UTC
Requires
- guzzlehttp/guzzle: ^6.5.5
README
base on tencent-api V3 version.
安装
$ 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");
Usage
1.在config文件里添加secretId和secretKey配置项
Contributing
You can contribute in one of three ways:
- File bug reports using the issue tracker.
- Answer questions or fix bugs on the issue tracker.
- Contribute new features or update the wiki.
The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.
License
MIT