0.6.1
2018-02-18
Log Service SDK for PHP,used to set/get log data to Aliyun Log Service(www.aliyun.com/product/sls).
composer require hongjianghuang/aliyun-log-php-sdk
$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');
}
- 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.
- PHP 7.1.7 and later:Master Branch
- PHP 5.2+:Tree v1.0