dev-master
9999999-dev https://github.com/larryli/yii2-pushbearPushBear Yii2 组件,使用 yii2-httpclient 包装 API。并提供 PushBearTarget 日志处理。
MIT
The Requires
by Larry Li
PushBear Yii2 组件,使用 yii2-httpclient 包装 API。并提供 PushBearTarget 日志处理。
PushBear Yii2 组件,使用 yii2-httpclient 包装 API。并提供 Target 日志处理。, (*1)
访问 https://pushbear.ftqq.com/admin/ 使用微信扫码登录后,创建消息通道,获取指定通道的 SendKey。, (*2)
通过 composer 安装。, (*3)
执行命令:, (*4)
php composer.phar require --prefer-dist larryli/yii2-pushbear
或者增加:, (*5)
"larryli/yii2-pushbear": "~1.0"
'components' => [ 'pushBear' => [ 'class' => \larryli\yii\pushbear\PushBear::class, 'sendKey' => 'your-SendKey', ], ],
try { Yii::$app->pushBear->sub('标题', "# 内容标题\n\n- 列表 1\n- 列表 2\n\n[链接](https://github.com/larryli/yii2-pushbear)"); } catch (\larryli\yii\pushbear\Exception $e) { echo $e->getMessage(); }
'components' => [ 'log' => [ 'targets' => [ [ 'class' => \larryli\yii\pushbear\Target::class, // 'pushBear' => 'pushBear', 'levels' => ['error', 'warning'], 'except' => [ // except self 'larryli\yii\pushbear\*', 'yii\httpclient\*', ], 'logVars' => [], // disable $_GET and others ], ], ], ],
使用 cURL 库发送 HTTP 消息,此传输需要安装 PHP 'curl' 扩展。, (*6)
'components' => [ 'pushBear' => [ 'class' => \larryli\yii\pushbear\PushBear::class, 'sendKey' => 'your-SendKey', 'transport' => \yii\httpclient\CurlTransport::class, ], ],
保存 Http 请求日志到指定日志文件。, (*7)
'components' => [ 'log' => [ 'targets' => [ [ 'class' => \yii\log\FileTarget::class, 'logFile' => '@runtime/logs/http-request.log', 'categories' => ['yii\httpclient\*'], ], ], ], ],
使用调试面板查看 Http 请求数据。, (*8)
'bootstrap' => ['debug'], 'modules' => [ 'debug' => [ 'class' => \yii\debug\Module::class, 'panels' => [ 'httpclient' => [ 'class' => \yii\httpclient\debug\HttpClientPanel::class, ], ], ], ],
PushBear Yii2 组件,使用 yii2-httpclient 包装 API。并提供 PushBearTarget 日志处理。
MIT