PHPackages                             qklin/laravel-notifys - 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. qklin/laravel-notifys

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

qklin/laravel-notifys
=====================

laravel/lumen 通知库

1.0.8(6y ago)0977MITPHPPHP ^7.0CI failing

Since Nov 2Pushed 6y ago1 watchersCompare

[ Source](https://github.com/qklandy/laravel-notifys)[ Packagist](https://packagist.org/packages/qklin/laravel-notifys)[ RSS](/packages/qklin-laravel-notifys/feed)WikiDiscussions master Synced yesterday

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

Laravel/Lumen Notify 通知库
========================

[](#laravellumen-notify-通知库)

[![PHP VERSION](https://camo.githubusercontent.com/12ea8f5e86d2e595f3b31d71d61d32ed1136c75fa09de3a676e3d453462b0948/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545372e302d626c7565)](https://camo.githubusercontent.com/12ea8f5e86d2e595f3b31d71d61d32ed1136c75fa09de3a676e3d453462b0948/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545372e302d626c7565)[![MIT](https://camo.githubusercontent.com/fa8c5ec43f4f772eca26774b5103639d3177f9ef0106e16ea52cfa03c88027f8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f716b6c616e64792f6c61726176656c2d6e6f7469667973)](https://camo.githubusercontent.com/fa8c5ec43f4f772eca26774b5103639d3177f9ef0106e16ea52cfa03c88027f8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f716b6c616e64792f6c61726176656c2d6e6f7469667973)

因依赖包guzzlehttp/client版本限制，本要求PHP版本要求7.0.0, 如果不需要可以自行定义移除依赖包

当前支持的通知应用:

1. 支持钉钉机器人通知
2. 支持微信企业机器人通知

Table of Contents
-----------------

[](#table-of-contents)

1. [安装](#%E5%AE%89%E8%A3%85)
2. [使用](#%E4%BD%BF%E7%94%A8)
    1. [钉钉使用](#%E9%92%89%E9%92%89%E4%BD%BF%E7%94%A8)
    2. [微信使用](#%E5%BE%AE%E4%BF%A1%E4%BD%BF%E7%94%A8)

安装
--

[](#安装)

### Composer:

[](#composer)

```
composer require qklin/laravel-notifys

```

### 配置

[](#配置)

#### env

[](#env)

```
# custom define your QKLIN_NOTIFY_CONFIG
QKLIN_NOTIFY_CONFIG=notify

```

#### {base}/config/{QKLIN\_NOTIFY\_CONFIG}.php

[](#baseconfigqklin_notify_configphp)

```
return [
    'default' => 'alarm_wx',
    'bizs' => [
        'alarm_dd' => [
            'driver' => 'dingding',
            'api' => 'https://oapi.dingtalk.com/robot/send?access_token={access_token}'
        ],
        'alarm_wx' => [
            'driver' => 'weixin',
            'api' => 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key={access_token}'
        ],
    ]
];

```

### register provider

[](#register-provider)

```
# add provider
$app->register(Qklin\Notify\NotifyProvider::class);

```

使用
--

[](#使用)

### 钉钉使用

[](#钉钉使用)

#### text

[](#text)

```
Notify::text("测试文字，不通知所有人", [mobile], false);
Notify::text(function(){return [];}, "测试文字，不通知所有人", [mobile], false);

```

#### link

[](#link)

```
Notify::link("标题", "内容", "https://www.baidu.com", "https://www.baidu.com/pc2.0/images/partner-box-img01.95f15298.png");

```

#### markdown

[](#markdown)

```
$markdown = 'http://www.baidu.com','title'=>'22'],
]);

```

#### feedCard

[](#feedcard)

```
$lists = [
    [
        "title" => 123,
        "messageURL" => "http://www.baidu.com",
        "picURL" => "https://www.baidu.com/pc2.0/images/partner-box-img01.95f15298.png",
    ],
    [
        "title" => 123,
        "messageURL" => "http://www.baidu.com",
        "picURL" => "https://www.baidu.com/pc2.0/images/partner-box-img01.95f15298.png",
    ]
];
Notify::feedCard($lists);

```

### 微信使用

[](#微信使用)

#### text

[](#text-1)

```
Notify::text("测试文字，不通知所有人", [mobile], false);
Notify::text(function(){return [];}, "测试文字，不通知所有人", [mobile], false);

```

#### markdown

[](#markdown-1)

```
$markdown =
