dev-master
9999999-devYii2 slack client based library
GPL-3.0
The Requires
extension yii2 slack
0.1.0
0.1.0.0Yii2 slack client based library
GPL-3.0
The Requires
extension yii2 slack
Wallogit.com
2017 © Pedro Peláez
Yii2 slack client based library
add, (*1)
"ambikuk/yii2-slack": "*"
to the require section of your composer.json file., (*2)
this extension just wrapper to https://github.com/maknz/slack, (*3)
Also, you should configure incoming webhook inside your Slack team., (*4)
Configure component:, (*5)
...
'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:, (*6)
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, (*7)
$slack = Yii::$app->slack;
$slack->setSetting([
'username' => 'Jack',
'channel' => '#mychannel'
]);
$slack->send('Are we rich yet?');
Use Maknz\Slack\Client functions, (*8)
$slack = Yii::$app->slack->getClient();
$slack->to('@username')->send('Yo!');
Yii2 slack client based library
GPL-3.0
extension yii2 slack
Yii2 slack client based library
GPL-3.0
extension yii2 slack