webtoolsnz / yii2-slack
Slack Integration for Yii LogTargets
Installs: 9 592
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 16
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- guzzlehttp/guzzle: ~6.0|~5.0|~4.0
- maknz/slack: ^1.7
- yiisoft/yii2: ~2.0.0
Requires (Dev)
- phpunit/phpunit: ~6.0|~5.0|~4.0
This package is auto-updated.
Last update: 2024-12-13 07:44:28 UTC
README
Provides a Yii2 LogTarget implementation for slack incoming webhooks.
Installation
The preferred way to install this extension is through composer.
composer require webtoolsnz/yii2-slack
Configuration Example
You will need to create an incoming webhook and configure the
webHookUrl
setting appropriately.
...
'components' => [
'log' => [
'targets' => [
[
'class' => 'webtoolsnz\slack\SlackTarget',
'levels' => ['error', 'warning'],
'webHookUrl' => 'https://your.webhook.url',
'except' => [
'yii\web\HttpException:404',
'yii\web\HttpException:403',
],
],
],
],
],
...
Settings
Besides the the properties inherited from \yii\log\Target the following settings are also supported
webHookUrl
: The generated URL for your incoming webhook- string
- required
channel
: the channel that messages will be sent to- string
- default: the setting on the webhook
username
: the username that messages will be sent from- string
- default: Will be generated based on server name or application name (depending if web or console application)
icon
: the icon messages will be sent with, either :emoji: or a URL to an image- string
- default:
:warning:
color
: the color of the message attachment, can be one ofgood
,warning
,danger
or any hex color code.- string
- default:
danger
showFullContext
: if set to true all of the usual context variables will be included in the attachment- bool
- default:
false