hongjianghuang / aliyun-log-php-sdk
There is no license information available for the latest version (v1.1) of this package.
Log Service SDK for PHP,used to set/get log data to Aliyun Log Service(www.aliyun.com/product/sls).
v1.1
2020-04-26 11:04 UTC
Requires
- php: >=7.1
This package is auto-updated.
Last update: 2025-02-26 21:56:35 UTC
README
API VERSION
0.6.1
SDK RELEASE TIME
2018-02-18
Introduction
Log Service SDK for PHP,used to set/get log data to Aliyun Log Service(www.aliyun.com/product/sls).
Use composer
composer require hongjianghuang/aliyun-log-php-sdk
Examples
$log_item = new \Aliyun_Log_Models_LogItem(); $log_item->setTime(time()); $log_item->setContents($contents); $endpoint = ''; $access_key_id = ''; $access_key = ''; $project = ''; $logstore = '' $topic = 'test'; $logitems = [ $log_item, ]; $client = new \Aliyun_Log_Client($endpoint, $access_key_id, $access_key); $request = new \Aliyun_Log_Models_PutLogsRequest($project, $logstore, $topic, $source, $logitems); $response = @$client->putLogs($request); if (200 != array_get($response->getAllHeaders(), '_info.http_code')) { throw new \Exception('Request aliyun error'); }
Summary
- Request-Request style Restful API interface
- Use Protocol buffer to send data
- Data can be compressed when sending to server
- Aliyun_Log_Exception 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 7.1.7 and later:Master Branch
- PHP 5.2+:Tree v1.0