walkboy/yii2-slack
最新稳定版本:1.0.1
Composer 安装命令:
composer require walkboy/yii2-slack
包简介
Yii2 slack client
README 文档
README
Designed to send messages to slack messenger
Based on unmaintained https://github.com/Understeam/yii2-slack
Installation
composer require walkboy/yii2-slack:^1.0
Also, you should configure incoming webhook inside your Slack team.
Usage
First of all, configure yiisoft/yii2-httpclient component:
... 'components' => [ 'httpclient' => [ 'class' => 'yii\httpclient\Client', ], ], ...
Also you can set it up only inside of slack client:
... 'components' => [ 'slack' => [ 'httpclient' => [ 'class' => 'yii\httpclient\Client', ], ... ], ], ...
Configure component:
... 'components' => [ 'slack' => [ 'class' => 'walkboy\slack\Slack', 'url' => '<slack incoming webhook url here>', 'username' => 'My awesome application', ], ], ...
Now you can send messages right into slack channel via next command:
Yii::$app->slack->send('Hello', ':thumbs_up:', [ // block object 1 [ 'type' => 'context', 'elements' => [ [ 'type' => 'mrkdwn', 'text' => 'Your markdown text here', ] ], ], // block object 2 [ 'type' => 'divider', ] ]);
To learn more about blocks, read Slack documentation
Also you can use slack as a log target:
... 'components' => [ 'log' => [ 'traceLevel' => 3, 'targets' => [ [ 'class' => 'walkboy\slack\LogTarget', 'categories' => ['commandBus'], 'exportInterval' => 1, // Send logs on every message 'logVars' => [], ], ], ], ], ...
统计信息
- 总下载量: 49
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2022-11-08