dev-master
9999999-devYii2 slack client based library
GPL-3.0
The Requires
by forecho
extension yii2 slack
v1.0
1.0.0.0Yii2 slack client based on GuzzleHttp library
GPL-3.0
The Requires
by forecho
extension yii2 slack
Yii2 slack client based library
Designed to send messages to slack messenger, (*1)
, (*2)
php composer.phar require --prefer-dist yiier/yii2-slack "*"
Also, you should configure incoming webhook inside your Slack team., (*3)
Configure component:, (*4)
... 'components' => [ 'slack' => [ 'httpClient' => ['class' => 'Curl\Curl'], 'class' => 'yiier\slack\Client', 'url' => '<slack incoming webhook url here>', 'username' => 'My awesome application', ], ], ...
Now you can send messages right into slack channel via next command:, (*5)
Yii::$app->slack->send('Hello', ':thumbs_up:', [ [ // attachment object 'text' => 'text of attachment', 'pretext' => 'pretext here', ], ]);
To learn more about attachments, read Slack documentation, (*6)
Also you can use slack as a log target:, (*7)
... 'components' => [ 'log' => [ 'traceLevel' => 3, 'targets' => [ [ 'class' => 'yiier\slack\LogTarget', 'categories' => ['commandBus'], 'exportInterval' => 1, // Send logs on every message 'logVars' => [], ], ], ], ], ...
or, (*8)
... 'components' => [ 'log' => [ 'traceLevel' => 3, [ 'class' => 'yiier\slack\LogTarget', 'levels' => ['error'], 'enabled' => true, 'emoji' => ':beetle:', 'logMessage' => '错误信息', 'categories' => [ 'yii\db\*', 'yii\web\HttpException:*', 'error', ], 'except' => [ 'yii\web\HttpException:404', // 除了404错误 ], 'exportInterval' => 1, // Send logs on every message 'logVars' => [], ], ], ], ...
Understeam/yii2-slack, (*9)
Yii2 slack client based library
GPL-3.0
extension yii2 slack
Yii2 slack client based on GuzzleHttp library
GPL-3.0
extension yii2 slack