A comprehensive Laravel package that seamlessly integrates Telegram notifications into your application's logging system.
Monitor critical events, debug issues, and stay informed about your application's health in real-time through Telegram channels or groups.
Supercharge your Laravel application monitoring with real-time Telegram messages from a form or external source.
- Introduction
- Installation
- Basic Usage
- Getting Telegram Credentials
- Security Best Practices
- Contributing
- Support
- License
- Attribution
Telegram Logs Monitor is a comprehensive Laravel package that seamlessly integrates Telegram notifications into your application's logging system. Monitor critical events, debug issues, and stay informed about your application's health in real-time through Telegram channels.
- Real-time Monitoring → Instant delivery of critical notifications to your Telegram channels
- Comprehensive Coverage → Support for all PSR-3 log levels from debug to emergency
- Smart Formatting → Beautiful JSON formatting with MarkdownV2 and HTML support
- Error Resilience → Graceful fallback when Telegram is unavailable
- Developer Friendly → Interactive setup and comprehensive testing tools
it is made to simplify life and handle receiving messages from a form or external source as form and view it into your telegram channel.
- Real-time Messaging → Instant delivery of messages notifications to your Telegram channels
- Smart Formatting → Beautiful text format with details on the source
- Error Resilience → Graceful fallback when Telegram is unavailable
- Monolog Integration
- Direct Messaging API
- Real-time Notifications
- Interactive Setup
- Comprehensive Testing
- Multi-level Logging
- Forum Groups Support
- Smart Message Handling
- Performance Optimized
- Error Resilience
- PHP: 8.1 or higher
- Laravel: 10.0 or higher
- Telegram Bot Token: Obtain from BotFather
- Telegram Channel/Group Chat ID: Destination for log notifications
composer require uzhlaravel/telegramlogsphp artisan telegramlogs:installThis guided process will:
- Publish the configuration file
- Help set up environment variables
- Optionally configure Telegram as your default logging channel
- Test your configuration
php artisan vendor:publish --tag="telegramlogs-config".env file:
LOG_CHANNEL=telegramTELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_CHAT_ID=your_chat_id_here
TELEGRAM_TOPIC_ID=your_thread_id_here
TELEGRAM_TOPIC_MESSAGE_ID=your_message_id_here
TELEGRAM_TIMEOUT=10
TELEGRAM_LOG_LEVEL=critical| Variable | Description | Required | Default |
|---|---|---|---|
| TELEGRAM_BOT_TOKEN | Bot API token | Yes | - |
| TELEGRAM_CHAT_ID | Target chat/channel ID | Yes | - |
| TELEGRAM_TOPIC_ID | Forum topic ID | No | null |
| TELEGRAM_TOPIC_MESSAGE_ID | Forum thread ID | No | null |
| TELEGRAM_LOG_LEVEL | Minimum log level | No | critical |
| TELEGRAM_TIMEOUT | API timeout (seconds) | No | 10 |
\Log::error('Payment processing failure detected');
try {
// Application code
} catch (\Exception $e) {
\Log::critical('API connectivity issue', [
'exception' => $e->getMessage(),
'code' => $e->getCode()
]);
}
\Log::debug('User authentication successful', [
'user_id' => auth()->id(),
'ip' => request()->ip()
]);php artisan telegramlogs:testOptions:
--message="Custom notification"→ Dispatch custom test message--level=error→ Specify log severity level--list→ Display available log levels--config→ Show current configuration values
Example:
php artisan telegramlogs:test --message="System health check" --level=warning{
"message": "Database connection failure",
"level": "CRITICAL",
"datetime": "2025-08-17T11:55:13.885292+00:00",
"context": {
"exception": "PDOException: driver not found"
}
}| Level | Description | Example Use Case |
|---|---|---|
| Debug | Detailed diagnostic info | Query debugging, variable inspection |
| Info | General operational messages | User login, cache clearing |
| Notice | Significant normal events | New user registration, order created |
| Warning | Potential issues | API rate limiting, deprecated usage |
| Error | Runtime errors | Payment failure, external API errors |
| Critical | Critical condition alerts | Database connection failure |
| Alert | Immediate action required | Security breach detection |
| Emergency | System instability | Server down, infrastructure failure |
- This is for testing and configuration purposes only.
- You can use the facade to send messages to your Telegram channel.
php artisan telegramlogs:test --config //to see the config
php artisan telegramlogs:test --list // ot see the list of log levels
php artisan telegramlogs:test --message="System health check" --level=warning // to send a custom messageTo send a message to your Telegram channel or from a form or just a simple word you want to pass , you have to use the facade for it but make sure to import it first.
use Uzhlaravel\Telegramlogs\Facades\TelegramMessage;then after this you can use the facade to send a message to your channel. like this :
use Uzhlaravel\Telegramlogs\Facades\TelegramMessage;
// Basic message transmission
TelegramMessage::message('System maintenance scheduled for tonight');
// Message with options
TelegramMessage::send('System maintenance scheduled for tonight', [
'parse_mode' => 'HTML',
'disable_web_page_preview' => true,
'reply_markup' => [
'inline_keyboard' => [
[
['text' => 'Start', 'callback_data' => 'start']
]
]
]
]);
// Targeted chat messaging
TelegramMessage::toChat('-100123456789', 'Specific channel notification');
// Connection testing
TelegramMessage::test();- Open @BotFather
- Send
/newbotand follow instructions - Copy token →
TELEGRAM_BOT_TOKEN
- Private chats → getUpdates API
- Channels → Add bot as admin →
-100xxxxxxxxx - Groups → Add bot, mention it → get
chat.id
- Create a topic
- Send message
- Get
message_thread_id
- Never commit tokens
- Restrict bot access
- Store secrets in
.env - Audit access regularly
- Fork repo
- Create branch →
git checkout -b feature/amazing-feature - Commit →
git commit -m 'Add some amazing feature' - Push →
git push origin feature/amazing-feature - Open PR
git clone https://github.com/Uzziahlukeka/telegrammonitor.git
composer install
composer analyze
composer format
composer test- Read docs + wiki
- Open issues on GitHub
- Join discussions
If helpful, consider:
- ⭐ Starring repo
- Sharing experience
- Reporting issues
This package is open-sourced software licensed under the MIT License.
- Developed by Uzziahlukeka
- Inspired by the Laravel community
💖 Made with love by Uzziah Lukeka