PHPackages                             demokn/yii2-wework-bot - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. demokn/yii2-wework-bot

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

demokn/yii2-wework-bot
======================

使用企业微信群机器人发送消息, https://work.weixin.qq.com/api/doc/90000/90136/91770

1.0.0(6y ago)04MITPHPPHP ^7.2CI failing

Since Apr 6Pushed 6y ago1 watchersCompare

[ Source](https://github.com/demokn/yii2-wework-bot)[ Packagist](https://packagist.org/packages/demokn/yii2-wework-bot)[ RSS](/packages/demokn-yii2-wework-bot/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (4)Versions (2)Used By (0)

yii2-wework-bot
===============

[](#yii2-wework-bot)

使用企业微信群机器人发送消息， 参考企业微信官方文档[群机器人配置说明](https://work.weixin.qq.com/api/doc/90000/90136/91770)

要求
--

[](#要求)

- php: ^7.2
- yiisoft/yii2: ~2.0.14
- guzzlehttp/guzzle: ~6.3

安装
--

[](#安装)

```
composer require "demokn/yii2-wework-bot:~1.0"
```

配置
--

[](#配置)

```
'components' => [
    // ...
    // 注册组件
    'weworkBot' => [
        'class' => \demokn\weworkbot\Bot::class,
        'webhook' => 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=YOUR_SECRET_KEY',
        'testMode' => !YII_ENV_PROD,
     ],
    // 注册多个实例
    'anotherWeworkBot' => [
        'class' => \demokn\weworkbot\Bot::class,
        'webhook' => 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=YOUR_SECRET_KEY',
        'testMode' => !YII_ENV_PROD,
     ],
    // 配置日志Target, 使用企业微信群机器人上报日志
    'log' => [
        'traceLevel' => YII_DEBUG ? 3 : 0,
        'targets' => [
            [
                'class' => \yii\log\FileTarget::class,
                'levels' => ['error', 'warning'],
            ],
            [
                'class' => \demokn\weworkbot\LogTarget::class,
                'levels' => ['error', 'warning'],
                'logVars' => [],
                'bot' => 'weworkBot',
            ],
        ],
    ],
    // ...
],
```

使用
--

[](#使用)

```
$bot = Yii::$app->weworkBot;

// 发送文本消息
$bot->send('这是一条文本消息');

// 发送复杂文本消息
$bot->send([
    'msgtype' => 'text',
    'text' => [
        'content' => '广州今日天气：29度，大部分多云，降雨概率：60%',
        'mentioned_list' => ['wangqing', '@all'],
        'mentioned_mobile_list' => ['13800001111', '@all'],
    ],
]);

// 发送markdown消息
$bot->send([
    'msgtype' => 'markdown',
    'markdown' => [
        'content' => "实时新增用户反馈132例，请相关同事注意。\n
>类型:用户反馈\n
>普通用户反馈:117例\n
>VIP用户反馈:15例",
    ],
]);
// ...
```

更多消息类型，参考企业微信官方文档[群机器人配置说明](https://work.weixin.qq.com/api/doc/90000/90136/91770)

License
-------

[](#license)

MIT

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

Unknown

Total

1

Last Release

2228d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/eab93aa3e3a99c1dfaca595efcc85a86c9d6574188811fade9891d8e2ed49f71?d=identicon)[demo\_knyang](/maintainers/demo_knyang)

---

Top Contributors

[![demokn](https://avatars.githubusercontent.com/u/11829894?v=4)](https://github.com/demokn "demokn (2 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/demokn-yii2-wework-bot/health.svg)

```
[![Health](https://phpackages.com/badges/demokn-yii2-wework-bot/health.svg)](https://phpackages.com/packages/demokn-yii2-wework-bot)
```

###  Alternatives

[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[dhlparcel/magento2-plugin

DHL Parcel plugin for Magento 2

11180.5k2](/packages/dhlparcel-magento2-plugin)[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)
