tencentcloud/tencentcloud-cls-sdk-php
最新稳定版本:v1.0.1
Composer 安装命令:
composer require tencentcloud/tencentcloud-cls-sdk-php
包简介
The Php SDK of Tencent Cloud CLS log service
README 文档
README
SDK RELEASE TIME
2022-04-20
Introduction
Log Service SDK for PHP,used to set log data to TencentCloud CLS Log Service.
API Reference:
Summary
- Request-Request style Restful API interface
- Use Protocol buffer to send data
- Data can be protobuf compressed when sending to server
- TencentCloudLogException will be thrown if any error happen
- Introduce simple logger for submit log easily with different levels
- Create local log cache to submit several logs in single http post.
Environment Requirement
- PHP 5.6.0 and later:Master Branch
LZ4 压缩上传
1、暂不支持LZ4 压缩上传
密钥信息
accessKeyId和accessKey为云API密钥,密钥信息获取请前往密钥获取。并请确保云API密钥关联的账号具有相应的SDK上传日志权限
Demo
<?php require_once __DIR__.'../../vendor/autoload.php'; use TencentCloud\Cls\Models\Request\PutLogsRequest; use TencentCloud\Cls\Models\LogItem; use TencentCloud\Cls\Client; use TencentCloud\Cls\TencentCloudLogException; function putLogs($client, $topicId) { $contents = array( 'TestKey'=>'TestContent', 'test2'=>'beijing' ); $logItem = new LogItem(); $logItem->setTime(time()); $logItem->setContents($contents); $logItems = array($logItem); $request = new PutLogsRequest($topicId, null, $logItems); try { $response = $client->putLogs($request); var_dump($response->getRequestId()); } catch (TencentCloudLogException $ex) { var_dump($ex); } catch (Exception $ex) { var_dump($ex); } } $endpoint = 'ap-guangzhou.cls.tencentcs.com'; $accessKeyId = ''; $accessKey = ''; $topicId = ''; $token = ""; $client = new Client($endpoint, $accessKeyId, $accessKey,$token); putLogs($client, $topicId); 统计信息
- 总下载量: 3.75k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2026-01-04