PHPackages                             firezihai/message-notification - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. firezihai/message-notification

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

firezihai/message-notification
==============================

消息通知SDK,集成钉钉、微信等平台消息通知功能

v1.0.4(3y ago)01.3k↓42.9%MITPHPPHP &gt;=7.4

Since May 18Pushed 3y ago1 watchersCompare

[ Source](https://github.com/firezihai/message-notification)[ Packagist](https://packagist.org/packages/firezihai/message-notification)[ RSS](/packages/firezihai-message-notification/feed)WikiDiscussions master Synced 1mo ago

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

message-notification
====================

[](#message-notification)

功能
--

[](#功能)

- 用于发送应用异常、工作等通知
- 支持多平台,如钉钉、企业微信
- 支持自定义发送平台

环境要求
----

[](#环境要求)

- hyperf &gt;= 2.0

安装
--

[](#安装)

```
composer require firezihai/message-notification -vvv

```

配置文件
----

[](#配置文件)

发布配置文件 config/autload/message\_notification.php

```
php bin/hyperf.php vendor:publish firezihai/message-notification

```

使用
--

[](#使用)

```
$message = make(MessageInterface::class);
message->send(['xxxxx']);

```

配置多个消息通知平台
----------

[](#配置多个消息通知平台)

当你需要多个平台发送不同的消息通知时，可以配置多个平台

1. 配置

```

  'default' => [
        'driver' => MessageNotification\Driver\DingTalk::class,
        'store' => [
            'driver' => MessageNotification\Store\Cache::class,
        ],
        'app' => [
            'appkey' => '',
            'appsecret' => '',
            'agent_id' => '',
        ],
    ],
    'qywechat' => [
        'driver' => MessageNotification\Driver\Qywechat::class,
        'store' => [
            'driver' => MessageNotification\Store\Cache::class,
        ],
        'app' => [
            'appkey' => '',
            'appsecret' => '',
            'agent_id' => '',
        ],
    ],
    'dingTalkRobot' => [
        'driver' => MessageNotification\Driver\DingTalkRobot::class,
        'store' => [
            'access_token' => '',
        ],
        'app' => [
            'app_name' => '系统通知',
            //如需加签配置此参数
            'appsecret' => '',
        ],
    ],

```

2. 使用

```
$message = make(MessageManager::class)->getDriver('qywechat');
message->send(['xxxxx']);

```

自定义消息通知平台
---------

[](#自定义消息通知平台)

实现 `PlatformInterface` 接口

1. 编写平台驱动类

```
class FeiShu implements PlatformInterface
{

     /**
     * 发送消息.
     */
    public function send(array $userId, string $message)
    {

    }

    /**
     *  根据手机号码获取userid.
     */
    public function getUserIdByMobile(string $mobile)
    {

    }

    /**
     * 获取token.
     */
    public function getAccessToken()
    {

    }

}

```

2. 配置驱动类

在`config/autoload/message_notification.php`文件配置新的驱动类

```

    'default' => [
        'driver' => FeiShu::class,
    ],

```

自定义 token 储存方式
--------------

[](#自定义-token-储存方式)

默认使用 redis 储存,如果你想使用数据库储存,可自定义储存驱动,只要实现 `StoreInterface` 类即可

1. 编写储存类

```

Db implements StoreInterface
{

	// $app 配置文件中的app配置项
    public function set(array $app,array $token)
    {
		....
		$update['access_token'] = $token['access_token'];
		$update['expires_in'] = $token['expires_in'];
		....
    }

    public function get(array $app)
    {
	  ....

	  return [
		   'access_token' => $token['access_token'],
           'expires_in' => $token['expires_in'],
		   'token_update_time'=>$token['token_update_time'],
	  ]
    }
}

```

2. 配置

在`config/autoload/message_notification.php`文件中配置新的储存驱动类

```

    'store' => [
        'driver' => DB::class,
    ],

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

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

Every ~65 days

Total

4

Last Release

1257d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/95ed582c23f06f22eb888b5c058dcf71433576112d21e7fc864cd26ef0644705?d=identicon)[firezihai](/maintainers/firezihai)

---

Top Contributors

[![firezihai](https://avatars.githubusercontent.com/u/9910490?v=4)](https://github.com/firezihai "firezihai (6 commits)")

---

Tags

phphyperf

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/firezihai-message-notification/health.svg)

```
[![Health](https://phpackages.com/badges/firezihai-message-notification/health.svg)](https://phpackages.com/packages/firezihai-message-notification)
```

###  Alternatives

[hyperf-ext/mail

The Hyperf Mail package.

1851.0k1](/packages/hyperf-ext-mail)[tomatophp/filament-accounts

Manage your multi accounts inside your app using 1 table with multi auth and a lot of integrations

748.3k7](/packages/tomatophp-filament-accounts)[djunehor/laravel-sms

Send SMS from your laravel application

385.3k1](/packages/djunehor-laravel-sms)

PHPackages © 2026

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