sergeymakinen / yii2-slack-log
Pretty Slack log target for Yii 2
Installs: 92 572
Dependents: 0
Suggesters: 0
Security: 0
Stars: 24
Watchers: 4
Forks: 3
Open Issues: 0
Type:yii2-extension
Requires
- sergeymakinen/yii2-log-message: ^2.0
- yiisoft/yii2: ~2.0.2
- yiisoft/yii2-httpclient: ~2.0.0
Requires (Dev)
- sergeymakinen/yii2-tests: ^2.0
README
Pretty Slack log target for Yii 2.
Installation
The preferred way to install this extension is through composer.
Either run
composer require "sergeymakinen/yii2-slack-log:^2.0"
or add
"sergeymakinen/yii2-slack-log": "^2.0"
to the require section of your composer.json
file.
Usage
First set up an incoming webhook integration in your Slack team and obtain a token. It should look like https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
.
Then set the following Yii 2 configuration parameters:
'components' => [ 'log' => [ 'targets' => [ [ 'class' => 'sergeymakinen\yii\slacklog\Target', 'webhookUrl' => 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX', ], ], ], ],
Sample config:
'components' => [ 'log' => [ 'targets' => [ [ 'class' => 'sergeymakinen\yii\slacklog\Target', 'levels' => ['error'], 'except' => [ 'yii\web\HttpException:*', ], 'enabled' => YII_ENV_PROD, 'webhookUrl' => 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX', 'username' => 'Fire Alarm Bot', 'iconEmoji' => ':poop:', ], ], ], ],