Download the PHP package stajor/laravel-telegram-logging without Composer
On this page you can find all versions of the php package stajor/laravel-telegram-logging. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stajor/laravel-telegram-logging
More information about stajor/laravel-telegram-logging
Files in stajor/laravel-telegram-logging
Package laravel-telegram-logging
Short Description Send logs to Telegram chat via Telegram bot
License MIT
Informations about the package laravel-telegram-logging
Laravel Telegram logger
Send logs to Telegram chat via Telegram bot
Install
Define Telegram Bot Token and chat id (users telegram id) and set as environment parameters. Add to .env
Add to config/logging.php file new channel:
If your default log channel is a stack, you can add it to the stack channel like this
Or you can simply change the default log channel in the .env
Publish config file and views
Telegram Logging Formats
You can choose among two different formats that you can specify in the .env file like this :
It is possible to create other blade templates and reference them in the TELEGRAM_LOGGER_TEMPLATE entry
Create bot
For using this package 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
/startmessage
Change log template at runtime
-
Change config for template.
- Use
Logas usual.
Configuring a different chat id or token per channel
-
Add
chat_idortokento channels inconfig/logging.php. Overridesconfig('telegram.chat_id'). - Use
Logas 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 and configure the file at bootstrap/app.php
- Place default Laravel/Lumen logging file to config/logging.php (to add new channel).
Proxy support
To use a proxy server, set the variable in the .env