PHPackages                             scratcher28/tg-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. scratcher28/tg-logger

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

scratcher28/tg-logger
=====================

A Laravel package for sending logs to Telegram

07PHP

Since Jan 17Pushed 1y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Telegram Logger for Laravel
===========================

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

A module for Laravel that allows you to send logs to Telegram.

Description
-----------

[](#description)

This module allows you to send logs to a Telegram group, breaking them down by topic. You can describe the configuration for the basic log types or write your own logging levels.

Installing the module
---------------------

[](#installing-the-module)

The installation is done using Composer:

```
composer require prog-time/tg-logger
```

Configuring the module
----------------------

[](#configuring-the-module)

1. Create a Telegram bot
2. Create a Telegram group and include "Topics" in it
3. Specify the variables in .environment

```
TG_LOGGER_TOKEN="token_bot"
TG_LOGGER_CHAT_ID="id_group"
```

4. Add the created bot and grant it administrator rights
5. Create a configuration file **config/tg-logger.php** manually or using a command.

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

6. In **config/tg-logger.php** specify the bot token, the ID of the created group, and describe the topics that need to be created.

```
return [
    'token' => env('TG_LOGGER_TOKEN'),
    'chat_id' => env('TG_LOGGER_CHAT_ID'),
    'topics' => [
        [
            'name' => 'Debug messages',
            'icon_color' => '9367192',
            'level' => 'debug',
        ],
        [
            'name' => 'Cron tasks',
            'icon_color' => '9367192',
            'level' => 'crone',
        ],
        [
            'name' => 'Errors',
            'icon_color' => '9367192',
            'level' => 'error, notice, warning, emergency',
        ]
  ]
];
```

7. Run the command to create themes in a group. After executing this command, the file **config/tg-logger.php** it will be overwritten and the topic IDs for each log type will be indicated in it.

```
php artisan tglogger:create-topics
```

Sending any type of error
-------------------------

[](#sending-any-type-of-error)

To catch all types of errors, you need to change the basic log handler in the configuration file **config/logging.php** by specifying the module classes as handlers.

```
'channels' => [
        ...
        'telegram' => [
            'driver' => 'monolog',
            'handler' => ProgTime\TgLogger\TgHandler::class,
            'formatter' => ProgTime\TgLogger\TgFormatter::class,
            'level' => 'debug',
        ],
        ...
    ],

```

and in .env, change the **LOG\_CHANNEL parameter**

```
LOG_CHANNEL=telegram

```

Calling the module operation directly
-------------------------------------

[](#calling-the-module-operation-directly)

To work with the module directly, you can use the following code.

```
TgLogger::sendLog('Your message', 'level');
```

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor1

Top contributor holds 93.3% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5d737ae125f717a0462dbab0ba2e5b24b1745b7a21c0344cc1109a305e112cec?d=identicon)[scratcher28](/maintainers/scratcher28)

---

Top Contributors

[![prog-time](https://avatars.githubusercontent.com/u/40496434?v=4)](https://github.com/prog-time "prog-time (28 commits)")[![scratcher28](https://avatars.githubusercontent.com/u/778716?v=4)](https://github.com/scratcher28 "scratcher28 (2 commits)")

### Embed Badge

![Health badge](/badges/scratcher28-tg-logger/health.svg)

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.1k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M137](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[datadog/php-datadogstatsd

An extremely simple PHP datadogstatsd client

19124.6M15](/packages/datadog-php-datadogstatsd)

PHPackages © 2026

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