PHPackages                             fangchaogang/kam-php - 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. fangchaogang/kam-php

ActiveLibrary

fangchaogang/kam-php
====================

可爱猫 PHP SDK

v1.0.1(4y ago)29MITPHPPHP 7.\*

Since Jan 23Pushed 4y ago1 watchersCompare

[ Source](https://github.com/fangchaogang/kam-php)[ Packagist](https://packagist.org/packages/fangchaogang/kam-php)[ RSS](/packages/fangchaogang-kam-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

### 安装

[](#安装)

```
composer require fangchaogang/kam-php "v1.*"
```

### 配置

[](#配置)

在 .env 或者环境变量中加入

```
KAM_URL=http://10.10.21.22:8073
```

### 使用

[](#使用)

[接口文档](http://blog.52keji.site/articles/2022/01/14/1642237882500)

#### 请求

[](#请求)

```
use Kam\Request\Base\SendLinkMsgRequest;
use Kam\Request\Base\SendShareMusicRequest;
use Kam\Request\Base\SendTextMsgRequest;
$robotWxId = 'wxid_lmqw4m0uznw522';
try {

    //发送消息
    $request = new SendTextMsgRequest();
    $request->setRobotWxId($robotWxId);
    $request->setToWxId('fcg_520');
    $request->setMsg('你好');
    $request->request();
    //发送分享连接
    $request = new SendLinkMsgRequest();
    $request->setRobotWxId($robotWxId);
    $request->setToWxId('fcg_520');
    $request->setTargetUrl('http://www.baidu.com');
    $request->setPicUrl('http://dgj-dev.kzmall.cc/statics/old/css/base/img/cooperation.png?ver=2.20.94');
    $request->setTitle('分享');
    $request->setText('我分享了地址');
    $request->request();
    //发送音乐
    $request = new SendShareMusicRequest();
    $request->setRobotWxId($robotWxId);
    $request->setToWxId('fcg_520');
    $request->setName('十年');
    //...其他请参考文档

} catch (\Exception $e) {
      //接口逻辑处理失败（明确返回的失败）
      //错误码：$e->getCode()
      //错误信息：$e->getMessage()
}
```

#### 机器人回调处理

[](#机器人回调处理)

```
use Kam\Notify\NotifyRobot;
//机器人回调参数（假设已经处理成数组）
$data = [
    'event' => 'GroupMsg',
    'from_wxid' => '17871913280@chatroom',
    'from_name' => '1234567',
    'final_from_wxid' => 'fcg_520',
    'final_from_name' => '突破',
    'robot_wxid' => 'wxid_lmqw4m0uznw522',
    'msg' => '好'
];
try {
    //NotifyRobot封装了request大部分接口，可以快捷的对事件进行处理
    $robot = NotifyRobot::make($data);
    switch ($robot->notifyData->getEvent()) {
        case $robot->notifyData::E_FRIEND_MSG: //私聊
             $response = $robot->sendTextMsg('私聊消息：' . $robot->notifyData->getMsg()); break;
        case $robot->notifyData::E_GROUP_MSG: //群聊消息
            //处理逻辑
             break;
        case $robot->notifyData::E_FRIEND_MSG: //私聊消息(包括公众号)
            break;
        //具体事件请参考notifyData对象
    }

} catch (\Exception $e) {
      //接口逻辑处理失败（明确返回的失败）
      //错误码：$e->getCode()
      //错误信息：$e->getMessage()
}
```

### 更新

[](#更新)

```
composer update fangchaogang/kam-php
```

### 反馈

[](#反馈)

若有任何建议或者问题，欢迎给我们 [提 issue](https://github.com/fangchaogang/kam-php/issues/new)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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 ~3 days

Total

2

Last Release

1563d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f1ac7d4e81a6d433faf05cd888f8d424a8cfe7a0c5ee85a8faa0635ba1d7236?d=identicon)[fangchaogang](/maintainers/fangchaogang)

---

Top Contributors

[![fangchaogang](https://avatars.githubusercontent.com/u/10544873?v=4)](https://github.com/fangchaogang "fangchaogang (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fangchaogang-kam-php/health.svg)

```
[![Health](https://phpackages.com/badges/fangchaogang-kam-php/health.svg)](https://phpackages.com/packages/fangchaogang-kam-php)
```

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k20](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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