PHPackages                             defstudio/laravel-telegram-log - 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. defstudio/laravel-telegram-log

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

defstudio/laravel-telegram-log
==============================

Telegram log channel for Laravel

01.4k1PHPCI failing

Since Jun 30Pushed 1y ago2 watchersCompare

[ Source](https://github.com/defstudio/laravel-telegram-log)[ Packagist](https://packagist.org/packages/defstudio/laravel-telegram-log)[ RSS](/packages/defstudio-laravel-telegram-log/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (3)Used By (0)

Laravel Telegram Handler
========================

[](#laravel-telegram-handler)

This is a monolog telegram handler for laravel applications

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

[](#installation)

You can install the package via composer:

```
composer require defstudio/laravel-telegram-log
```

You can publish the config file with:

```
php artisan vendor:publish --provider="Defstudio\LaravelTelegramLog\LaravelTelegramLogServiceProvider" --tag="config"
```

This is the contents of the published config file:

```
return [
    'bot_token' => env('TELEGRAM_BOT_TOKEN'),
    'chat_id' => env('TELEGRAM_CHAT_ID'),
];
```

Usage
-----

[](#usage)

Add the new Log Channel in **config/logging.php**:

```
'telegram' => [
    'driver' => 'custom',
    'via'    => LaravelTelegramLog::class,
    'level'  => 'error',
],
```

If you use the **stack channel** as default logger, you can just the telegram channel to your stack:

```
'stack' => [
    'driver' => 'stack',
    'channels' => ['single', 'telegram'],
]
```

Or you can simply change the default logging channel in the .env file.

```
LOG_CHANNEL=telegram
```

Great! Your Laravel project can now send logs to your Telegram chat.

You can use **Laravel Log Facade** to send logs to your chat:

```
// Use the Laravel Log Facade
use Illuminate\Support\Facades\Log;
...

// All Laravel log leves are avaiable
Log::channel('telegram')->emergency($message);
Log::channel('telegram')->alert($message);
Log::channel('telegram')->critical($message);
Log::channel('telegram')->error($message);
Log::channel('telegram')->warning($message);
Log::channel('telegram')->notice($message);
Log::channel('telegram')->info($message);
Log::channel('telegram')->debug($message);
```

Telegram Instructions
=====================

[](#telegram-instructions)

Instructions for creating a new Telegram Bot and getting chat\_id from a particular group or chat.

Creating a Bot
--------------

[](#creating-a-bot)

1. Go to [@BotFather](https://t.me/botfather) on Telegram.
2. Send `/newbot`, to start creating a new Bot.

    [![message](https://camo.githubusercontent.com/456f36cbff05035a6789746bbf414a920852089e6ef914e66a8f1943338be406/68747470733a2f2f692e696d6775722e636f6d2f4d324b454570322e706e67)](https://camo.githubusercontent.com/456f36cbff05035a6789746bbf414a920852089e6ef914e66a8f1943338be406/68747470733a2f2f692e696d6775722e636f6d2f4d324b454570322e706e67)
3. Set the bot's username and username.

    [![defines-a-bot-name](https://camo.githubusercontent.com/9c1afa2e8f26e15825b367f1182d6bc63b15a2d25a3bf5fc698c84e246685ed8/68747470733a2f2f692e696d6775722e636f6d2f697870665666512e706e67)](https://camo.githubusercontent.com/9c1afa2e8f26e15825b367f1182d6bc63b15a2d25a3bf5fc698c84e246685ed8/68747470733a2f2f692e696d6775722e636f6d2f697870665666512e706e67)
4. Now you need to allow your Bot to send direct messages, so send `/setjoingroups` to @BotFather, select your Bot and click Enable:

    [![set-join-group](https://camo.githubusercontent.com/3f1300d1d4e22095d202c5f5900b1d0b84501ac2f12b1becb613bf377386c9c4/68747470733a2f2f692e696d6775722e636f6d2f54436b34576b432e706e67)](https://camo.githubusercontent.com/3f1300d1d4e22095d202c5f5900b1d0b84501ac2f12b1becb613bf377386c9c4/68747470733a2f2f692e696d6775722e636f6d2f54436b34576b432e706e67)
5. Get the Bot token and add it to your .env file.

    [![get-bot-token](https://camo.githubusercontent.com/87a67f3a9e2b3ae58d68630ab50449e8b9a953148228f0c754d91168c6b75f1f/68747470733a2f2f692e696d6775722e636f6d2f45777268766d552e706e67)](https://camo.githubusercontent.com/87a67f3a9e2b3ae58d68630ab50449e8b9a953148228f0c754d91168c6b75f1f/68747470733a2f2f692e696d6775722e636f6d2f45777268766d552e706e67)

    Bot Token in .env:

    [![token-in-env-file](https://camo.githubusercontent.com/ee5be602eedd5cae9eed01a3263cb7070fd56c5b0f106ded4262f9f69ac9a2e5/68747470733a2f2f692e696d6775722e636f6d2f536e69546951742e706e67)](https://camo.githubusercontent.com/ee5be602eedd5cae9eed01a3263cb7070fd56c5b0f106ded4262f9f69ac9a2e5/68747470733a2f2f692e696d6775722e636f6d2f536e69546951742e706e67)

Getting a Telegram Chat ID
--------------------------

[](#getting-a-telegram-chat-id)

- If you want to send messages to a group:

    1. Add your Bot to a Telegram group.
    2. Send any message from another user to this group.
- If you want send direct messages to a user:

    1. Search for your bot name, and select the chat.
    2. Send `/start` to your Bot.

3. Visit the following link to get updates about your bot and get chat\_id:

Replace all **X** in the URL with your **Bot Token**.

4. Search for the chat that you want to send messages, and get the **chat-&gt;id**:

    [![get-a-chat-id](https://camo.githubusercontent.com/7aad2703462f6d2e603d25cc437744fed6a78f619c48af52fdabfa1aafbee452/68747470733a2f2f692e696d6775722e636f6d2f454a49566657632e706e67)](https://camo.githubusercontent.com/7aad2703462f6d2e603d25cc437744fed6a78f619c48af52fdabfa1aafbee452/68747470733a2f2f692e696d6775722e636f6d2f454a49566657632e706e67)
5. Add it to your .env file:

    [![env](https://camo.githubusercontent.com/427fc8196713a29cce2fa70374120e543b3ba9032a353fe44655d6501651f441/68747470733a2f2f692e696d6775722e636f6d2f617152645631532e706e67)](https://camo.githubusercontent.com/427fc8196713a29cce2fa70374120e543b3ba9032a353fe44655d6501651f441/68747470733a2f2f692e696d6775722e636f6d2f617152645631532e706e67)

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Fabio Ivona](https://github.com/FabioIvona)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 82.6% 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/db5e0ab5568062368a52c61d67381c1a35be5e5c816968dd3883bc7ba2d46b53?d=identicon)[fabio.ivona](/maintainers/fabio.ivona)

---

Top Contributors

[![fabio-ivona](https://avatars.githubusercontent.com/u/8792274?v=4)](https://github.com/fabio-ivona "fabio-ivona (19 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")

### Embed Badge

![Health badge](/badges/defstudio-laravel-telegram-log/health.svg)

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/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.2M138](/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)
