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

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

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

leovince/monolog-teams

Composer 安装命令:

composer require leovince/monolog-teams

包简介

Monolog handler for sending log messages to Microsoft Teams channels via Workflows.

README 文档

README

This package provides a Monolog handler that delivers log records to a Microsoft Teams channel by calling an HTTP endpoint generated by a Teams Workflow.

Installation

You can install the package via composer:

composer require leovince/monolog-teams

Configuring Workflows on Microsoft Teams

  • In Microsoft Teams, open the Team that contains the channel intended to receive log messages.
  • Add the Workflows app to the team if it is not already installed.
  • Open the Workflows app and create a new workflow.
  • Choose the template “Send webhook alerts to a channel”.
  • When prompted, select the Team and Channel where messages should be posted.
  • The workflow will generate a unique HTTP POST URL.

Usage

use LeoVince\MonologTeams\TeamsHandler;
use Monolog\Level;
use Monolog\Logger;

// Create the logger
$log = new Logger('my_logger');
$log->pushHandler(new TeamsHandler('LOG_TEAMS_WEBHOOK_URL', 'APP_NAME', level: Level::Error));

// Use the logger
$log->error('Error message');

Usage with Laravel

Add to config/logging.php the following configuration under the channels key:

'teams' => [
    'driver'  => 'monolog',
    'handler' => LeoVince\MonologTeams\TeamsHandler::class,
    'level' => env('LOG_LEVEL', 'error'),
    'handler_with' => [
        'webhookUrl' => env('LOG_TEAMS_WEBHOOK_URL'),
        'name' => env('APP_NAME', 'Laravel'),
        'includeContextAndExtra' => true,
    ],
],

Add to .env the following variable:

LOG_TEAMS_WEBHOOK_URL=LOG_TEAMS_WEBHOOK_URL

Testing

composer test

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固