tencentcloud/tencentcloud-cls-sdk-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

tencentcloud/tencentcloud-cls-sdk-php

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);

统计信息

  • 总下载量: 5.12k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 16
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固