PHP code example of mbpcoder / laravel-monolog-rocketchat

1. Go to this page and download the library: Download mbpcoder/laravel-monolog-rocketchat 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/ */

    

mbpcoder / laravel-monolog-rocketchat example snippets


return [
    'channels' => [
        'stack' => [
            'driver'   => 'stack',
            'channels' => ['single', 'rocketchat'],
        ],

        'rocketchat' => [
            'driver' => 'monolog',
            'level' => 'debug',
            'handler' => TheCoder\MonologRocketChat\RocketChatBotHandler::class,
            'handler_with' => [
                'token' => env('LOG_ROCKET_CHAT_BOT_TOKEN'),
                'chat_id' => env('LOG_ROCKET_CHAT_CHAT_ID'),
                'api_url' => env('LOG_ROCKET_CHAT_BOT_API'),
                'queue' => env('LOG_ROCKET_CHAT_QUEUE', null)
                'queue_connection' => env('LOG_ROCKET_CHAT_QUEUE_CONNECTION', null),
            ],
            'formatter' => TheCoder\MonologRocketChat\RocketChatFormatter::class,
            'formatter_with' => [
                'tags' => env('LOG_ROCKET_CHAT_TAGS', null),
            ],
        ],
    ],
];

logger('message', [
    'token' => 'your_bot_token',
    'chat_id' => 'your_chat_id'
]);
ini
LOG_ROCKET_CHAT_BOT_TOKEN=
LOG_ROCKET_CHAT_CHAT_ID=
LOG_ROCKET_CHAT_BOT_API=