PHPackages                             marekmiklusek/telegram-logger - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. marekmiklusek/telegram-logger

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

marekmiklusek/telegram-logger
=============================

A Laravel package to send logs to Telegram.

v1.1.3(1mo ago)0256MITPHPPHP ^8.2

Since Feb 19Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/marekmiklusek/telegram-logger)[ Packagist](https://packagist.org/packages/marekmiklusek/telegram-logger)[ RSS](/packages/marekmiklusek-telegram-logger/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (15)Used By (0)

[![blog-featured-how-to-delete-telegram](https://private-user-images.githubusercontent.com/112761697/414854543-78d2e1ec-7b2d-4e59-9b07-45a08aec6a56.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzIyNzY4ODIsIm5iZiI6MTc3MjI3NjU4MiwicGF0aCI6Ii8xMTI3NjE2OTcvNDE0ODU0NTQzLTc4ZDJlMWVjLTdiMmQtNGU1OS05YjA3LTQ1YTA4YWVjNmE1Ni5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwMjI4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDIyOFQxMTAzMDJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kMGY4ZDcyZWNmZWY5NmQyZTcyYTc0OWEzNTlmYjdmNTY5OTBmODA5NzIwN2U0ZmI0YzM0MzcwNDYxZDVhYjQ3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.jKNFo31VN8m55GjaXjm87fKZQaTa0Kvd9AxkyWUdNgE)](https://private-user-images.githubusercontent.com/112761697/414854543-78d2e1ec-7b2d-4e59-9b07-45a08aec6a56.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzIyNzY4ODIsIm5iZiI6MTc3MjI3NjU4MiwicGF0aCI6Ii8xMTI3NjE2OTcvNDE0ODU0NTQzLTc4ZDJlMWVjLTdiMmQtNGU1OS05YjA3LTQ1YTA4YWVjNmE1Ni5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwMjI4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDIyOFQxMTAzMDJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kMGY4ZDcyZWNmZWY5NmQyZTcyYTc0OWEzNTlmYjdmNTY5OTBmODA5NzIwN2U0ZmI0YzM0MzcwNDYxZDVhYjQ3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.jKNFo31VN8m55GjaXjm87fKZQaTa0Kvd9AxkyWUdNgE)

📢 Laravel Telegram Logger
=========================

[](#-laravel-telegram-logger)

🚀 **Laravel Telegram Logger** is a package that sends **Laravel log messages** and **exceptions** to **Telegram** for real-time monitoring.

📌 Features
----------

[](#-features)

✅ **Real-time logging** to Telegram
✅ **Supports all log levels** (`debug`, `info`, `warning`, `error`, etc.)
✅ **Automatic exception handling** (captures error file, line, and message)
✅ **Configurable log level filtering**
✅ **Silent notifications support** (to avoid sound/vibration in Telegram)
✅ **Minimal setup, easy to integrate**
✅ **Can be enabled/disabled via configuration**

---

🛠 Installation
--------------

[](#-installation)

Require the package via Composer:

```
composer require marekmiklusek/telegram-logger
```

🔧 Configuration
---------------

[](#-configuration)

Publish the package configuration:

```
php artisan vendor:publish --tag=telegram-logger-config
```

This will create a config file at `config/telegram-logger.php`.

### .env Configuration

[](#env-configuration)

Add your Telegram Bot API token and Chat ID to your `.env` file:

```
TELEGRAM_BOT_TOKEN=your_bot_token
TELEGRAM_CHAT_ID=your_chat_id
```

### Config File (`config/telegram-logger.php`)

[](#config-file-configtelegram-loggerphp)

```
return [
    'bot_token' => env('TELEGRAM_BOT_TOKEN'),
    'chat_id' => env('TELEGRAM_CHAT_ID'),
    'level' => 'error',
    'silent_notification' => false,
    'is_enabled' => true,
];
```

🏗 Usage
-------

[](#-usage)

### Basic Logging

[](#basic-logging)

Use Laravel's `Log` facade as usual, and errors will be sent to Telegram automatically:

```
use Illuminate\Support\Facades\Log;

Log::debug('Debug message');
Log::info('Info message');
Log::warning('Warning message');
Log::error('Error message');
```

### Logging with Context

[](#logging-with-context)

You can pass additional context to logs:

```
Log::error('User not found', ['user_id' => 42, 'action' => 'login']);
```

### Logging Exceptions

[](#logging-exceptions)

Exceptions are automatically detected and logged:

```
try {
    throw new \Exception('Database connection failed!');
} catch (\Exception $exception) {
    Log::error('Unhandled exception occurred', ['exception' => $exception]);
}
```

⚙ How It Works
--------------

[](#-how-it-works)

The package listens to Laravel's logging events and sends structured messages to Telegram.

### Example Telegram Log Output

[](#example-telegram-log-output)

```
🛠️ Application: MyLaravelApp
🌍 Environment: production

❌ Level: ERROR
📝 Message: "User not found"

📌 File:
/var/www/html/app/Http/Controllers/UserController.php:45

📂 Context:
{
  "user_id": 42,
  "action": "login"
}

⏳ Time: 2025-02-19 10:15:30

```

### Example Telegram Log Output (Exception)

[](#example-telegram-log-output-exception)

```
🛠️ Application: MyLaravelApp
🌍 Environment: production

❌ Level: ERROR
🔥 Exception Occurred !
💥 Message: "Database connection failed!"

📌 File:
/var/www/html/app/Services/DatabaseService.php:30

⏳ Time: 2025-02-19 10:18:45

```

🎯 Advanced Configuration
------------------------

[](#-advanced-configuration)

### 1️⃣ Logger Enablement

[](#1️⃣-logger-enablement)

You can enable or disable the logger in `config/telegram-logger.php`:

```
return [
    'is_enabled' => false,
];
```

✅ If `true`, logs will be sent to Telegram as configured
✅ If `false`, the logger will be completely disabled (no logs sent)

### 2️⃣ Log Level Filtering

[](#2️⃣-log-level-filtering)

You can define the minimum log level in `config/telegram-logger.php`:

```
return [
    'level' => 'warning',
];
```

- `debug`: Logs everything
- `info`: Logs `info`, `notice`, `warning`, `error`, `critical`, `alert`, `emergency`
- `error`: Logs `error`, `critical`, `alert`, `emergency`
- `critical`: Logs only `critical`, `alert`, `emergency`

### 3️⃣ Silent Notifications

[](#3️⃣-silent-notifications)

Enable silent notifications (no sound/vibration) in `config/telegram-logger.php`

```
return [
    'silent_notification' => true,
];
```

✅ If `true`, messages will be sent silently.
✅ If `false`, Telegram will send notifications normally.

💡 Troubleshooting
-----------------

[](#-troubleshooting)

❓ **Logs not appearing in Telegram?**

1. Check that your `.env` values are correctly set:

```
php artisan config:clear
php artisan config:cache
```

2. Ensure your bot has permission to send messages to your chat.

❓ **Getting "Chat not found" error?**

- Make sure you have sent a message to your bot first.
- Use [this tool](https://telegram.me/userinfobot) to get your Chat ID.

📜 License
---------

[](#-license)

This package is open-source and licensed under the [MIT License](LICENSE.md).

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance70

Regular maintenance activity

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~30 days

Recently: every ~72 days

Total

14

Last Release

58d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b43359edbb79cfeec622571fbf701e4bf401283a5a717e1bfc296d360608459?d=identicon)[marekmiklusek](/maintainers/marekmiklusek)

---

Top Contributors

[![marekmiklusek](https://avatars.githubusercontent.com/u/112761697?v=4)](https://github.com/marekmiklusek "marekmiklusek (33 commits)")

---

Tags

phplaravelpackageloggertelegramlaravel-telegram-logger

### Embed Badge

![Health badge](/badges/marekmiklusek-telegram-logger/health.svg)

```
[![Health](https://phpackages.com/badges/marekmiklusek-telegram-logger/health.svg)](https://phpackages.com/packages/marekmiklusek-telegram-logger)
```

###  Alternatives

[guanguans/laravel-exception-notify

Monitor exception and report to the notification channels(Log、Mail、AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

14642.7k1](/packages/guanguans-laravel-exception-notify)[ucan-lab/laravel-blink-logger

Comprehensive Logging Tool for Laravel.

126.1k](/packages/ucan-lab-laravel-blink-logger)[tomatophp/filament-logger

Log all user activity to file or log driver and preview it on your FilamentPHP panel

162.2k](/packages/tomatophp-filament-logger)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
