Download the PHP package muhamadzain/laravel-telegram-log without Composer
On this page you can find all versions of the php package muhamadzain/laravel-telegram-log. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download muhamadzain/laravel-telegram-log
More information about muhamadzain/laravel-telegram-log
Files in muhamadzain/laravel-telegram-log
Package laravel-telegram-log
Short Description laravel log record and send into Telegram Chat Bot
License MIT
Informations about the package laravel-telegram-log
Laravel Telegram Bot Logging
Send logs to Telegram chat via Telegram bot. Inspired by https://github.com/grkamil/laravel-telegram-logging
Requirement
- PHP 8.0 above
- Laravel 8 or higher
Install
Configurations
Please define Telegram Bot Credentials and chat id as environment parameters by modifying .env
on your project path
Create new logging channel by modifying config/logging.php file
Or if your default log channel is a stack, you can add it to the stack channel like this
By default LOG_CHANNEL
will be set into stack
so you need to set default logger on env after setting up configurations above
Publish config file and views to override
Create bot
For using this plugin, you need to create telegram bot
- Go to @BotFather in the Telegram
- Send
/newbot
- Set up name and bot-name for your bot.
- Get token and add it to your .env file (it is written above)
- Go to your bot and send
/start
message
Change log template at runtime
-
Change config for template.
- Use
Log
as usual
Lumen support
To make it work with Lumen, you need also run two steps:
-
Place config/telegram-logger.php file with following code:
- Uncomment
$app->withFacades();
and configure the file$app->configure('telegram-logger');
at bootstrap/app.php - Place default Laravel/Lumen logging file to config/logging.php (to add new channel).
Copyright © 2023 by Muhamad Zainal Arifin