Download the PHP package denoby/laravel-telegram-logger without Composer
On this page you can find all versions of the php package denoby/laravel-telegram-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-telegram-logger
Laravel Telegram Logger
Русский
A Laravel package for sending application logs and messages to Telegram.
Features
- Send Laravel logs to Telegram chat/group/channel
- Support for Telegram topics (threads)
- Fluent message builder with photo/video support
- Configurable exception filtering
- User info in log messages
- Markdown formatting
Installation
The package will auto-register its service provider.
Publish Configuration
Configuration
Add the following to your .env file:
Getting Your Bot Token
- Open Telegram and search for @BotFather
- Send
/newbotand follow the instructions - Copy the token provided
Getting Your Chat ID
- Add your bot to the group/channel where you want to receive logs
- Send a message to the group
- Visit
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates - Find the
chat.idin the response
Usage
As a Log Channel
Add the Telegram channel to your config/logging.php:
You can add it to your stack:
Or use it directly:
As a Tap (Adding to Existing Channels)
You can add Telegram logging to any existing channel using the tap option. This sends logs to both the original channel AND Telegram:
The Tap class uses the telegram-logger.level config value (default: error) to filter which logs are sent to Telegram. You can set it via environment variable:
Per-channel Overrides (thread_id and level)
You can override the global TELEGRAM_LOG_THREAD_ID and log level on a per-channel basis. This is useful when you want different log categories to go to different topics of the same supergroup.
Through Logger (custom channel):
Through Tap (positional arguments thread_id,level):
If a channel does not set an override, the global TELEGRAM_LOG_THREAD_ID / TELEGRAM_LOG_LEVEL from .env is used.
Sending Messages Directly
Use the Facade to send messages:
Building Messages
Sending Documents
Configuration Options
Log Message Format
Log messages are formatted in Markdown with the following information:
- App URL - Clickable link to your application
- Environment - Current environment (production, staging, etc.)
- Log Level - As a hashtag (#ERROR, #WARNING, etc.)
- Branch - Deploy branch (if configured)
- User ID - Authenticated user info (if enabled)
- File - File and line number where the exception occurred
- Message - The log message
- Stack Trace - Filtered to show only app-related traces
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-telegram-logger with dependencies
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^10.0|^11.0|^12.0|^13.0
monolog/monolog Version ^3.0