PHP code example of minkhantnaung / laravel-telegram-topic-logger

1. Go to this page and download the library: Download minkhantnaung/laravel-telegram-topic-logger library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

minkhantnaung / laravel-telegram-topic-logger example snippets


'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'),
    ],
],

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');

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

Log::channel('telegram_topic')->error(
    "🚨 OTP Error\nUser ID: 123\nPhone: 09xxxxxx"
);
bash
php artisan vendor:publish --tag=telegram-topic-logger-config