Download the PHP package uzhlaravel/telegramlogs without Composer
On this page you can find all versions of the php package uzhlaravel/telegramlogs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download uzhlaravel/telegramlogs
More information about uzhlaravel/telegramlogs
Files in uzhlaravel/telegramlogs
Package telegramlogs
Short Description Monitor your Laravel application logs in real-time through Telegram. This package delivers instant notifications of critical events directly to your Telegram channel, with support for threaded discussions and Markdown formatting.
License MIT
Homepage https://github.com/Uzziahlukeka/telegrammonitor
Informations about the package telegramlogs
Telegram Logs Monitor for Laravel
A Laravel package that sends your application logs, exceptions, and model activity events directly to a Telegram channel or group — in real time.
Supports Laravel 10 → 13, PHP 8.2+, and includes production-only mode so notifications stay silent during local development.
Table of Contents
- Features
- Requirements
- Installation
- Configuration
- Environment Variables
- Restrict to Production Only
- Usage
- Log Channel Integration
- Direct Messaging
- Activity Log
- HasTelegramActivity Trait
- TelegramActivity Facade
- Artisan Commands
- Log Levels
- Getting Telegram Credentials
- Security
- Contributing
- License
Features
- Monolog integration — drop-in
telegramlog channel; works withLOG_CHANNEL=telegramor as a stacked channel - Direct messaging — send arbitrary text to any chat from anywhere in your app
- Activity log — track Eloquent model
created / updated / deletedevents and push them to Telegram (inspired by spatie/laravel-activitylog) - Production-only mode — restrict notifications to specific environments with a single env var
- Smart formatting — emoji-labelled MarkdownV2 messages with context, exception details, and stack traces
- Long message splitting — automatically splits messages that exceed Telegram's 4096-char limit
- Forum/topic support — route messages to specific threads in a Telegram group
- Interactive install — guided
telegramlogs:installcommand
Requirements
| Dependency | Version |
|---|---|
| PHP | ^8.2 |
| Laravel | ^10.0 | ^11.0 | ^12.0 | ^13.0 |
Installation
Run the interactive setup wizard:
The wizard will publish the config file, help you set environment variables, optionally enable activity log, and send a test message.
Or publish the config manually:
Configuration
Environment Variables
Add these to your .env file:
Full Reference
| Variable | Required | Default | Description |
|---|---|---|---|
TELEGRAM_BOT_TOKEN |
Yes | — | Bot API token from @BotFather |
TELEGRAM_CHAT_ID |
Yes | — | Target chat, channel, or group ID |
TELEGRAM_TOPIC_ID |
No | null |
Forum topic (thread) ID |
TELEGRAM_TOPIC_MESSAGE_ID |
No | null |
Forum thread message ID |
TELEGRAM_LOG_LEVEL |
No | critical |
Minimum PSR-3 level to send |
TELEGRAM_TIMEOUT |
No | 10 |
HTTP timeout in seconds |
TELEGRAM_ENVIRONMENTS |
No | production |
Comma-separated env list, or * |
TELEGRAM_ACTIVITY_LOG |
No | false |
Enable model activity tracking |
TELEGRAM_ACTIVITY_LOG_LEVEL |
No | info |
Log level for activity messages |
Restrict to Production Only
By default, notifications are only sent when APP_ENV=production. This prevents your local machine or CI from flooding your Telegram channel.
The current environment and whether notifications are active are both shown in:
Usage
Log Channel Integration
Set Telegram as your default channel:
Or add it to a stack so critical logs go to both your file log and Telegram:
Use it like any Laravel logger:
Messages arrive in Telegram formatted like this:
Direct Messaging
Send arbitrary messages to Telegram without going through the logger — useful for contact forms, webhooks, or manual alerts.
Activity Log
Inspired by spatie/laravel-activitylog, the activity log tracks Eloquent model events and pushes a formatted notification to Telegram.
Enable it in .env:
HasTelegramActivity Trait
Add the trait to any Eloquent model to automatically track its lifecycle events:
On created, updated, or deleted, a message like the following is sent to Telegram:
Customise per model:
Global event list is controlled in config/telegramlogs.php:
TelegramActivity Facade
For manual / one-off activity notifications, use the fluent facade:
Artisan Commands
Log Levels
| Level | Emoji | Use Case |
|---|---|---|
emergency |
🚨 | System is unusable |
alert |
🔴 | Immediate action required |
critical |
💥 | Critical conditions |
error |
❌ | Runtime errors |
warning |
⚠️ | Potential issues |
notice |
📢 | Significant normal events |
info |
ℹ️ | General operational messages |
debug |
🐛 | Detailed diagnostic information |
Getting Telegram Credentials
1. Create a Bot
- Open @BotFather in Telegram
- Send
/newbotand follow the prompts - Copy the token into
TELEGRAM_BOT_TOKEN
2. Get Your Chat ID
- Channel — add the bot as an admin; the channel username (
@mychannel) or numeric ID (-100xxxxxxxxx) works - Group — add the bot to the group; send a message, then call
https://api.telegram.org/bot<token>/getUpdatesto findchat.id - Private chat — start a chat with the bot, then use
getUpdates
3. Forum Topics (optional)
- Enable Topics in your group settings
- Create a topic and send a message
- From
getUpdates, copymessage_thread_id→TELEGRAM_TOPIC_ID
Security
- Store
TELEGRAM_BOT_TOKENonly in.env— never commit it - Restrict which commands the bot can receive (via BotFather →
/mybots → Bot Settings → Group Privacy) - Audit who has access to your Telegram channel regularly
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Commit your changes:
git commit -m 'Add my feature' - Push:
git push origin feature/my-feature - Open a pull request
Development commands:
License
This package is open-sourced software licensed under the MIT License.
💖 Made with love by Uzziah Lukeka
All versions of telegramlogs with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^11.0||^12.0||^13.0
illuminate/database Version ^10.0||^11.0||^12.0||^13.0
illuminate/events Version ^10.0||^11.0||^12.0||^13.0
illuminate/support Version ^10.0||^11.0||^12.0||^13.0