ambikuk/yii2-slack
最新稳定版本:0.1.0
Composer 安装命令:
composer require ambikuk/yii2-slack
包简介
Yii2 slack client based library
关键字:
README 文档
README
Installation
add
"ambikuk/yii2-slack": "*"
to the require section of your composer.json file.
this extension just wrapper to https://github.com/maknz/slack
Also, you should configure incoming webhook inside your Slack team.
Usage
Configure component:
... 'components' => [ 'slack' => [ 'class' => 'ambikuk\yiislack\Slack', 'url' => '<slack incoming webhook url here>', 'username' => 'Slack Bot', 'channel' => '#channel' ], ], ...
Now you can send messages right into slack channel via next command:
Yii::$app->slack->send('New alert from the monitoring system', [ 'fallback' => 'Current server stats', 'text' => 'Current server stats', 'color' => 'danger', 'fields' => [ [ 'title' => 'CPU usage', 'value' => '90%', 'short' => true // whether the field is short enough to sit side-by-side other fields, defaults to false ], [ 'title' => 'RAM usage', 'value' => '2.5GB of 4GB', 'short' => true ] ] ]);
Use custom settings
$slack = Yii::$app->slack; $slack->setSetting([ 'username' => 'Jack', 'channel' => '#mychannel' ]); $slack->send('Are we rich yet?');
Use Maknz\Slack\Client functions
$slack = Yii::$app->slack->getClient(); $slack->to('@username')->send('Yo!');
统计信息
- 总下载量: 9.5k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2017-07-27