Skip to content

ide2/TelegramHandler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TelegramHandler

SensioLabsInsight Scrutinizer Code Quality Build Status

Handle logs with telegram bot

Simple monolog with telegram

Installation

Install the latest version with

composer require ide2/telegram-handler

Basic Usage

<?php

require 'vendor/autoload.php';

use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use TelegramHandler\TelegramHandler;
use TelegramHandler\TelegramFormatter;

// create a log channel
$token   = '123456:abcdefgdkjaskldjas';
$chat_id = 123456789;

$log     = new Logger('MyTestApplication');
$handler = new TelegramHandler($token, $chat_id, Logger::INFO);
$handler->setFormatter(new TelegramFormatter());
$log->pushHandler($handler);

$log->addInfo('Lorem ipsum dolor sit.', ['test', 'test test']);
$log->addError('Lorem ipsum dolor sit.');