PHPackages                             hedeqiang/green - 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. hedeqiang/green

ActiveLibrary

hedeqiang/green
===============

阿里云内容安全 PHP SDK

v1.0.2(5y ago)17MITPHP

Since Sep 4Pushed 5y ago1 watchersCompare

[ Source](https://github.com/hedeqiang/green)[ Packagist](https://packagist.org/packages/hedeqiang/green)[ RSS](/packages/hedeqiang-green/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

 green
=======

[](#-green-)

 阿里云内容安全 PHP SDK.

> 请先阅读 [阿里云内容安全文档](https://help.aliyun.com/document_detail/63004.html?spm=a2c4g.11186623.6.606.4a9160d1jDj9ak)

Installing
----------

[](#installing)

```
$ composer require hedeqiang/green -vvv
```

Usage
-----

[](#usage)

```
require __DIR__ .'/vendor/autoload.php';

use Hedeqiang\Green\Green;

$config = [
    'accessKeyId' => '',
    'accessKeySecret' => '',
    //'regionId' => '',
    //timeout => 6
    //'connectTimeout' => 6,
    //debug' => false,
];

$green = new Green($config);
```

### 文本内容检测

[](#文本内容检测)

```
$green->textScan(['文本1','文本2']); # 支持数组、字符串
```

### 文本检测内容反馈

[](#文本检测内容反馈)

```
$green->textFeedback($taskId); # 支持数组、字符串
```

### 图片同步检测

[](#图片同步检测)

```
$green->imageSyncScan($url, $scenes = ['porn', 'terrorism','ad']); # url 支持数组、字符串
```

### 图片异步检测

[](#图片异步检测)

```
$green->imageAsyncScan($url, $scenes = ['porn', 'terrorism','ad']); # url 支持数组、字符串
```

### 图片异步检测结果

[](#图片异步检测结果)

```
$green->imageAsyncScanResults($taskIds);
```

### 图片检测结果反馈

[](#图片检测结果反馈)

```
$green->imageScanFeedback($taskId);
```

### More...

[](#more)

在 Laravel 中使用
-------------

[](#在-laravel-中使用)

#### 发布配置文件

[](#发布配置文件)

```
php artisan vendor:publish --tag=green
```

##### 编写 .env 文件

[](#编写-env-文件)

```
GREEN_ACCESS_KEY_ID=
GREEN_ACCESS_KEY_SECRET=
GREEN_REGION_ID=cn-beijing
GREEN_TIMEOUT=6
GREEN_CONNECT_TIMEOUT=6
GREEN_DEBUG=false

```

### 方法参数注入

[](#方法参数注入)

参数和上面一样

```
public function index(Green $green)
{
    $response = $green->textScan(['文本1','文本2']); # 支持数组、字符串
}
```

### 服务名访问

[](#服务名访问)

```
public function index()
{
    $response = app('green')->textScan(['文本1','文本2']); # 支持数组、字符串
}
```

### Facades 门面使用(可以提示)

[](#facades-门面使用可以提示)

```
use Hedeqiang\Green\Facades\Green;
$response = Green::green()->textScan(['文本1','文本2']);
```

返回格式示例
------

[](#返回格式示例)

```
{
    "code":200,
    "data":[
        {
            "code":200,
            "content":"文本1",
            "dataId":"5f508a2dec2a6",
            "msg":"OK",
            "results":[
                {
                    "label":"normal",
                    "rate":99.91,
                    "scene":"antispam",
                    "suggestion":"pass"
                }
            ],
            "taskId":"txt5iHPuCGHb024i2AWj92PTK-1t5arO"
        },
        {
            "code":200,
            "content":"文本2",
            "dataId":"5f508a2dec2a8",
            "msg":"OK",
            "results":[
                {
                    "label":"normal",
                    "rate":99.91,
                    "scene":"antispam",
                    "suggestion":"pass"
                }
            ],
            "taskId":"txt1KDW04MfrTP5ijNpdjokAe-1t5arO"
        }
    ],
    "msg":"OK",
    "requestId":"F07776F3-E584-4A8C-B4CB-B7AA954823C1"
}
```

TODO

Contributing
------------

[](#contributing)

You can contribute in one of three ways:

1. File bug reports using the [issue tracker](https://github.com/hedeqiang/green/issues).
2. Answer questions or fix bugs on the [issue tracker](https://github.com/hedeqiang/green/issues).
3. Contribute new features or update the wiki.

*The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.*

License
-------

[](#license)

MIT

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~2 days

Total

3

Last Release

2077d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ac33cc87fe5ba7f0b8791f5b3453501e83b55ec9a5a209728817ff119635a72?d=identicon)[hedeqiang](/maintainers/hedeqiang)

---

Top Contributors

[![hedeqiang](https://avatars.githubusercontent.com/u/31909061?v=4)](https://github.com/hedeqiang "hedeqiang (31 commits)")

### Embed Badge

![Health badge](/badges/hedeqiang-green/health.svg)

```
[![Health](https://phpackages.com/badges/hedeqiang-green/health.svg)](https://phpackages.com/packages/hedeqiang-green)
```

###  Alternatives

[inccleo/green

阿里云内容安全

252.7k](/packages/inccleo-green)

PHPackages © 2026

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