承接 gh-rboliveira/monolog-telegram 相关项目开发

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

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

gh-rboliveira/monolog-telegram

Composer 安装命令:

composer require gh-rboliveira/monolog-telegram

包简介

A handler for Monolog that sends messages to Telegram Channels

README 文档

README

Install using composer:

composer require gh-rboliveira/monolog-telegram  

Usage

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

  • $level - The minimum logging level at which this handler will be triggered
  • $bubble - Whether the messages that are handled can bubble up the stack or not

Examples

Now Simply use it like this :

require 'vendor/autoload.php';
use Monolog\Logger;
use gh_rboliveira\TelegramHandler\TelegramHandler;

$log = new Logger('TelegramHandler');
//Create handler
$telegramHandler = new TelegramHandler();

//Add $token - your bot token provided by BotFather
$token = 'XXXXXXXXX:qeQWLElwe_m232WE1K3WEe323eeTw';
$telegramHandler->setBotToken($token);

//Set Receipts - an array with telegram ids
$recipients = ['123456789','987654321'];
$telegramHandler->setRecipients($recipients);

//Set Handler
$log->pushHandler($telegramHandler);

$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 parameter 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 !

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-02-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固