yiier/yii2-slack 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

yiier/yii2-slack

最新稳定版本:v1.1.0

Composer 安装命令:

composer require yiier/yii2-slack

包简介

Yii2 slack client based library

README 文档

README

Designed to send messages to slack messenger

How it looks

Installation

php composer.phar require --prefer-dist yiier/yii2-slack "*"

Also, you should configure incoming webhook inside your Slack team.

Usage

Configure component:

...
    '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:

Yii::$app->slack->send('Hello', ':thumbs_up:', [
    [
        // attachment object
        'text' => 'text of attachment',
        'pretext' => 'pretext here',
    ],
]);

To learn more about attachments, read Slack documentation

Also you can use slack as a log target:

...
'components' => [
    'log' => [
        'traceLevel' => 3,
        'targets' => [
            [
                'class' => 'yiier\slack\LogTarget',
                'categories' => ['commandBus'],
                'exportInterval' => 1, // Send logs on every message
                'logVars' => [],
            ],
        ],
    ],
],
...

or

...
'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' => [],
        ],
    ],
],
...

Credits

Understeam/yii2-slack

统计信息

  • 总下载量: 16.5k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2016-06-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固