PHP code example of jonathanoff2022 / laravel-telegram-logging

1. Go to this page and download the library: Download jonathanoff2022/laravel-telegram-logging 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/ */

    

jonathanoff2022 / laravel-telegram-logging example snippets


'telegram' => [
    'driver' => 'custom',
    'via'    => Logger\TelegramLogger::class,
    'level'  => 'debug',
]

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

config(['telegram-logger.template'=>'laravel-telegram-logging::custom'])

[
    'channels' => [
        [
            'company' => [
                'driver' => 'custom',
                'via' => TelegramLogger::class,
                'chat_id' => env('TELEGRAM_COMPANY_CHAT_ID'),
                'token' => env('TELEGRAM_COMPANY_BOT_TOKEN'),
                'level' => 'debug'
            ],

            'operations' => [
                'driver' => 'custom',
                'via' => TelegramLogger::class,
                'chat_id' => env('TELEGRAM_OPERATIONS_CHAT_ID'),
                'token' => env('TELEGRAM_OPERATIONS_BOT_TOKEN'),
                'level' => 'debug'
            ]
        ]
    ]
]



return [
    // Telegram logger bot token
    'token' => env('TELEGRAM_LOGGER_BOT_TOKEN'),

    // Telegram chat id
    'chat_id' => env('TELEGRAM_LOGGER_CHAT_ID'),
    
    // you can define your custom template for message
    // e.g: logging.template
    // 'template' => 'some your view path'
];

LOG_CHANNEL=telegram

php artisan vendor:publish --provider "Logger\TelegramLoggerServiceProvider"