iqbalatma/laravel-telegram-bot-channel-async 问题修复 & 功能扩展

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

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

iqbalatma/laravel-telegram-bot-channel-async

最新稳定版本:v1.0.0

Composer 安装命令:

composer require iqbalatma/laravel-telegram-bot-channel-async

包简介

README 文档

README

This is a laravel package that used to send application log with Monolog library via telegram channel asynchronously.

Install

Use composer from your terminal to intall this package

composer require iqbalatma/laravel-telegram-bot-channel-async

Define Telegram Bot Token and chat id (channel id) and set into .env file

TELEGRAM_APP_KEY=12345:asdngasd13rcffas12r
TELEGRAM_CHANNEL="@atmadevlogging"

Add new channel into config/logging.php

"channels" => [
	...,
	"telegram" => [
		"driver" => "custom",
            	"via" => new Iqbalatma\LaravelTelegramBotChannelAsync\TelegramLogger(env('TELEGRAM_APP_KEY'), env('TELEGRAM_CHANNEL'), true),
            	"level" => "debug"
	]
]

If you are using log channel type is stack, you can add channel name "telegram" into the array set like this

"stack" => [
    	"driver" => "stack",
	"channels" => ["single", "telegram"],
]

This package using laravel queue, so the message send asynchronously with Job Class. Before you can use this application you need to set the queue and running the worker. For example you can change the QUEUE_CONNECTION into database (you can use any other driver to do this, like redis).

QUEUE_CONNECTION=database

After you change the queue env config, you need to run the migration and the worker with this command

php artisan queue:table
php artisan migrate
php artisan queue:work

You need to configure the service provider so when the application got an error exception, it can be also send asyncrhonously with overriding the report method handler.

Add the service provider into config/app.php file

/*
* Package Service Providers...
*/
Iqbalatma\LaravelTelegramBotChannelAsync\Providers\TelegramBotChannelServiceProvider::class,

You can log the application with Log class and different level. First parameter is string for log message, and then second parameter is array for log context (optional)

use Iqbalatma\LaravelTelegramBotChannelAsync\Log;

Log::debug("This is debug message");
Log::info("This is info message");
Log::notice("This is notice message");
Log::warning("This is warning message");
Log::error("This is error message");
Log::critical("This is critical message");
Log::emergency("This is emergency message", , ["problem" => "Some problem description"]);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-02-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固