graceman9/monolog-telegram 问题修复 & 功能扩展

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

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

graceman9/monolog-telegram

最新稳定版本:1.0.6

Composer 安装命令:

composer require graceman9/monolog-telegram

包简介

A handler for Monolog that sends messages to Telegram Channels

README 文档

README

Telegram Handler for php monolog which allows you to log messages into telegram channels using bots .

Latest Stable Version Total Downloads License

Screenshot

telegram handler demo screenshot

Installation

Install using composer:

composer require rahimi/monolog-telegram  

Usage

it is just like other monolog handlers, you need to pass below paramaters to telegramhandler object:

  • $token your bot token provided by BotFather
  • $channel your telegram channel userName
  • $date_default_timezone_set choose date_default_timezone_set function timezone (optional)
  • $dateFormat pass date format (optional)

Examples

Now Simply use it like this :

require 'vendor/autoload.php';
use Monolog\Logger;
use rahimi\TelegramHandler\TelegramHandler;
$log = new Logger('TelegramHandler');
$log->pushHandler(new TelegramHandler($token,$channel,'UTC','F j, Y, g:i a'));


$log->info('hello world !');
/**
* There is 8 level of logging
*/
$log->notice('hello world !');
$log->info('hello world !');
$log->debug('hello world !');
$log->warning('hello world !');
$log->critical('hello world !');
$log->alert('hello world !');
$log->emergency('hello world !');
$log->error('hello world !');


/**
* Optionally you can pass second paramater such as a object
**/
$log->info('user just logged in !',['user'=>$user]);

License

This tool in Licensed under MIT, so feel free to fork it and make it better that it is !

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-14