定制 tencentcloud/tencentcloud-cls-sdk-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

  1. Request-Request style Restful API interface
  2. Use Protocol buffer to send data
  3. Data can be protobuf compressed when sending to server
  4. TencentCloudLogException will be thrown if any error happen
  5. Introduce simple logger for submit log easily with different levels
  6. Create local log cache to submit several logs in single http post.

Environment Requirement

  1. 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.78k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2022-11-09