PHPackages                             minkhantnaung/laravel-telegram-topic-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. minkhantnaung/laravel-telegram-topic-logger

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

minkhantnaung/laravel-telegram-topic-logger
===========================================

A Laravel logging channel for sending logs to Telegram with topic/thread support

v1.1.0(1w ago)2215MITPHPPHP ^8.2CI passing

Since Jan 7Pushed 1w agoCompare

[ Source](https://github.com/MinKhantNaung/laravel-telegram-topic-logger)[ Packagist](https://packagist.org/packages/minkhantnaung/laravel-telegram-topic-logger)[ RSS](/packages/minkhantnaung-laravel-telegram-topic-logger/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (8)Versions (3)Used By (0)

Laravel Telegram Topic Logger
=============================

[](#laravel-telegram-topic-logger)

[![Latest Version](https://camo.githubusercontent.com/7db2b2f055162936023183bb3a556b19adca9f0417506926964d30303babc541/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d696e6b68616e746e61756e672f6c61726176656c2d74656c656772616d2d746f7069632d6c6f67676572)](https://packagist.org/packages/minkhantnaung/laravel-telegram-topic-logger)[![Total Downloads](https://camo.githubusercontent.com/7dbd13440342bf173172fa91a7e8473b7113a598043e00e8edc2b1b11682890c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d696e6b68616e746e61756e672f6c61726176656c2d74656c656772616d2d746f7069632d6c6f67676572)](https://packagist.org/packages/minkhantnaung/laravel-telegram-topic-logger)[![License](https://camo.githubusercontent.com/58a578dda27812fafc37d86eee920d688e35d71ce12a593e677747af0f5e265c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d696e6b68616e746e61756e672f6c61726176656c2d74656c656772616d2d746f7069632d6c6f67676572)](LICENSE.md)

A Laravel custom logging channel that sends application logs to Telegram groups or channels, with full support for Telegram **topic threads** (`message_thread_id`) using Monolog v3.

[![Example](example.png)](example.png)

> **Note:** This package supports public and private Telegram groups, supergroups, and channels.

Why use this package?
---------------------

[](#why-use-this-package)

- ✅ Supports Telegram **topic threads** (`message_thread_id`)
- ✅ Works with Monolog v3 and Laravel 11, 12, and 13
- ✅ Simple custom channel configuration
- ✅ No third-party Telegram SDK required

Requirements
------------

[](#requirements)

- PHP &gt;= 8.2 (PHP &gt;= 8.3 is required when using Laravel 13)
- Laravel 11, 12, or 13
- Monolog &gt;= 3.0

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require minkhantnaung/laravel-telegram-topic-logger
```

Configuration
-------------

[](#configuration)

### 1. Publish the configuration file (optional)

[](#1-publish-the-configuration-file-optional)

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

### 2. Configure your logging channel

[](#2-configure-your-logging-channel)

Add a custom channel to your `config/logging.php` file:

```
'channels' => [
    // ... other channels ...

    'telegram_topic' => [
        'driver' => 'custom',
        'via' => \Minkhantnaung\TelegramTopicLogger\TelegramTopicLogger::class,
        'chat_id' => env('TELEGRAM_CHAT_ID'),
        'thread_id' => env('TELEGRAM_THREAD_ID'), // Optional: for topic threads
        'token' => env('TELEGRAM_BOT_TOKEN'),
        'level' => env('TELEGRAM_LOG_LEVEL', 'debug'),
    ],
],
```

### 3. Environment Variables

[](#3-environment-variables)

Add the following to your `.env` file:

```
TELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_CHAT_ID=your_chat_id_here
TELEGRAM_THREAD_ID=your_thread_id_here  # Optional
TELEGRAM_LOG_LEVEL=debug
```

Usage
-----

[](#usage)

Once configured, you can use the logging channel in your application:

```
Log::channel('telegram_topic')->info('This is an info message');
Log::channel('telegram_topic')->error('This is an error message');
Log::channel('telegram_topic')->warning('This is a warning message');
```

Or add it to your stack:

```
'stack' => [
    'driver' => 'stack',
    'channels' => ['single', 'telegram_topic'],
    'ignore_exceptions' => false,
],
```

Example: Sending Error Reports
------------------------------

[](#example-sending-error-reports)

```
Log::channel('telegram_topic')->error(
    "🚨 OTP Error\nUser ID: 123\nPhone: 09xxxxxx"
);
```

Getting Your Telegram Bot Token
-------------------------------

[](#getting-your-telegram-bot-token)

1. Open Telegram and search for [@BotFather](https://t.me/botfather)
2. Send `/newbot` and follow the instructions
3. Copy the bot token provided

Getting Your Chat ID
--------------------

[](#getting-your-chat-id)

This package works with both **public** and **private** Telegram groups and channels.

1. Add your bot to a group or channel (public or private)
2. Send a message to the group/channel
3. Visit `https://api.telegram.org/bot/getUpdates`
4. Find the `chat.id` value in the response

Getting Your Thread ID (for Topics)
-----------------------------------

[](#getting-your-thread-id-for-topics)

> ⚠️ Telegram topics are available only in **supergroups**.
> If `thread_id` is not provided, messages will be sent to the **General** topic.

1. Enable topics in your Telegram group
2. Create a topic or use an existing one
3. Send a message to the topic
4. Visit `https://api.telegram.org/bot/getUpdates`
5. Find the `message_thread_id` value in the response

Support the project
-------------------

[](#support-the-project)

If this package helps you, please consider giving it a ⭐ on GitHub. It helps others discover the project and motivates further development.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance98

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

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 ~168 days

Total

2

Last Release

11d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/12b96883bac9d2925d7f6938095ad4cdcc259016abb590d2def1551f44edb261?d=identicon)[MinKhantNaung](/maintainers/MinKhantNaung)

---

Top Contributors

[![MinKhantNaung](https://avatars.githubusercontent.com/u/117900000?v=4)](https://github.com/MinKhantNaung "MinKhantNaung (12 commits)")

---

Tags

laravelloggingmonologphptelegramlaravelloggingtelegrammonologThreadtopic

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/minkhantnaung-laravel-telegram-topic-logger/health.svg)

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[illuminate/log

The Illuminate Log package.

6225.3M625](/packages/illuminate-log)[naoray/laravel-github-monolog

Log driver to store logs as github issues

10823.1k](/packages/naoray-laravel-github-monolog)[thecoder/laravel-monolog-telegram

Telegram Handler for Monolog

2942.5k](/packages/thecoder-laravel-monolog-telegram)[shaffe/laravel-mail-log-channel

A package to support logging via email in Laravel

1395.1k](/packages/shaffe-laravel-mail-log-channel)[jacklul/monolog-telegram

Monolog handler that sends logs through Telegram bot to any chat in HTML format

2471.4k2](/packages/jacklul-monolog-telegram)

PHPackages © 2026

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