承接 culy/monolog-microsoft-teams 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

culy/monolog-microsoft-teams

Composer 安装命令:

composer require culy/monolog-microsoft-teams

包简介

Monolog Handler for sending messages to Microsoft Teams using the Incoming Webhook connector

README 文档

README

Monolog Handler for sending messages to Microsoft Teams channels using the Incoming WebHook connector.

Install

$ composer require culy/monolog-microsoft-teams

Usage

$logger = new \Culy\Microsoft\Teams\TeamsLogger('INCOMING_WEBHOOK_URL', \Monolog\Logger::ERROR);
$logger->error('Error message');

or

$logger = new \Monolog\Logger('app');
$logger->pushHandler(new \Culy\Microsoft\Teams\TeamsLogHandler('INCOMING_WEBHOOK_URL', \Monolog\Logger::ERROR));

Usage with Laravel/Lumen framework (5.6+)

Create a custom channel

config/logging.php

'teams' => [
    'driver' => 'custom',
    'via' => \Culy\Microsoft\Teams\TeamsLogChannel::class,
    'level' => 'error',
    'url' => 'INCOMING_WEBHOOK_URL',
],

Send an error message to the teams channel:

Log::channel('teams')->error('Error message');

You can also add teams to the default stack channel so all errors are automatically send to the teams channel.

'channels' => [
    'stack' => [
        'driver' => 'stack',
        'channels' => ['single', 'teams'],
    ],
],

Unit testing · PhpUnit

The tests require a valid Teams Incoming Webhook URL. To provide this URL to PhpUnit, copy phpunit.xml.dist to phpunit.xmland set the URL in the <php> section. Make sure to not commit your local phpunit.xml into the repo!

<php>
    <env name="TEAMS_INCOMING_WEBHOOK_URL" value="https://outlook.office.com/webhook/..." />
</php>

Run the tests on the command line:

$ composer test

License

monolog-microsoft-teams is available under the MIT license. See the LICENSE file for more info.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 16
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固