PHPackages                             f1ery/yii2-sls - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. f1ery/yii2-sls

ActiveProject[Framework](/categories/framework)

f1ery/yii2-sls
==============

Yii2 sls project

03PHP

Since Jun 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/f1ery/yii2-sls)[ Packagist](https://packagist.org/packages/f1ery/yii2-sls)[ RSS](/packages/f1ery-yii2-sls/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Yii2的sls组件
==========

[](#yii2的sls组件)

API版本
-----

[](#api版本)

1.0.3

组件发布日期
------

[](#组件发布日期)

2021-06-09

简单介绍
----

[](#简单介绍)

AliyunSlsLog是一个php的composer包，通过putLog方法写入数据到sls的log中，也可以通过getLogs方法获取logs列表。

API Reference: ([https://help.aliyun.com/document\_detail/29007.html](https://help.aliyun.com/document_detail/29007.html))

安装
--

[](#安装)

方法一：通过composer包的安装方法

composer require qimao/yii2-sls

方法二：添加composer.json配置文件

"qimao/yii2-sls": "~1.0.0"

使用说明
----

[](#使用说明)

```
$endpoint = 'cn-shanghai.log.aliyuncs.com';
$accessKeyId = 'xxxxxxxxxxxxxx';
$accessKey = 'xxxxxxxxxxxxxx';
$project = 'xxxxxxxx';
$logstore = 'xxxxxxx';
$topic = 'xxxxxx';
$contents = [
    'mes' => 'test mes',
];

//创建logstore
(new AliyunSlsLog($accessKeyId, $accessKey, $endpoint, $project))->createLogStore($logstore);

//推送log
(new AliyunSlsLog($accessKeyId, $accessKey, $endpoint, $project))->putLog($logstore, $topic, $contents);

//批量获取一天内(86400s)某个logstore下logs(前100条)
$rs = (new AliyunSlsLog($accessKeyId, $accessKey, $endpoint, $project))->batchGetLogs($logstore);

//列出某个project下logstore列表
$rs = (new AliyunSlsLog($accessKeyId, $accessKey, $endpoint, $project))->listLogstores();

//列出某个project下topic列表
$rs = (new AliyunSlsLog($accessKeyId, $accessKey, $endpoint, $project))->listTopics($logStore);

//获取一天内logs
$rs = (new AliyunSlsLog($accessKeyId, $accessKey, $endpoint, $project))->getLogs($logstore, $topic, 86400);

//获取Histograms
$rs = (new AliyunSlsLog($accessKeyId, $accessKey, $endpoint, $project))->getHistograms($logstore, $topic, 86400);

//获取shard列表
$rs = (new AliyunSlsLog($accessKeyId, $accessKey, $endpoint, $project))->listShard($logstore);

//获取60秒内logs
$rs = (new AliyunSlsLog($accessKeyId, $accessKey, $endpoint, $project))->batchGetLogsWithRange($logstore);

//合并shard
$rs = (new AliyunSlsLog($accessKeyId, $accessKey, $endpoint, $project))->mergeShard($logstore, 'MTYyaaaaaaaaaaaaaa=');

//切割shard
$rs = (new AliyunSlsLog($accessKeyId, $accessKey, $endpoint, $project))->splitShard($logstore, 'MTYyaaaaaaaaaaaaaa=', '');
print_r($rs);

```

异常处理
----

[](#异常处理)

查看对应项目error目录日志(Yii::error())

Environment Requirement
-----------------------

[](#environment-requirement)

1. PHP 7+
2. Yii2

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22760702?v=4)[wulve.wang](/maintainers/f1ery)[@f1ery](https://github.com/f1ery)

---

Top Contributors

[![f1ery](https://avatars.githubusercontent.com/u/22760702?v=4)](https://github.com/f1ery "f1ery (11 commits)")

### Embed Badge

![Health badge](/badges/f1ery-yii2-sls/health.svg)

```
[![Health](https://phpackages.com/badges/f1ery-yii2-sls/health.svg)](https://phpackages.com/packages/f1ery-yii2-sls)
```

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
