PHP code example of theriddleofenigma / laravel-google-chat-log

1. Go to this page and download the library: Download theriddleofenigma/laravel-google-chat-log 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/ */

    

theriddleofenigma / laravel-google-chat-log example snippets


'google-chat' => [
    'driver' => 'monolog',
    'url' => env('LOG_GOOGLE_CHAT_WEBHOOK_URL'),
    'notify_users' => [
        'default' => env('LOG_GOOGLE_CHAT_NOTIFY_USER_ID_DEFAULT'),
        'emergency' => env('LOG_GOOGLE_CHAT_NOTIFY_USER_ID_EMERGENCY'),
        'alert' => env('LOG_GOOGLE_CHAT_NOTIFY_USER_ID_ALERT'),
        'critical' => env('LOG_GOOGLE_CHAT_NOTIFY_USER_ID_CRITICAL'),
        'error' => env('LOG_GOOGLE_CHAT_NOTIFY_USER_ID_ERROR'),
        'warning' => env('LOG_GOOGLE_CHAT_NOTIFY_USER_ID_WARNING'),
        'notice' => env('LOG_GOOGLE_CHAT_NOTIFY_USER_ID_NOTICE'),
        'info' => env('LOG_GOOGLE_CHAT_NOTIFY_USER_ID_INFO'),
        'debug' => env('LOG_GOOGLE_CHAT_NOTIFY_USER_ID_DEBUG'),
    ],
    'level' => env('LOG_LEVEL', 'debug'),
    'handler' => \Enigma\GoogleChatHandler::class,
],

use Enigma\GoogleChatHandler;
use Illuminate\Http\Request;

class AppServiceProvider {
    public function register() {}
    public function boot() {
        GoogleChatHandler::$additionalLogs = function () {
            return [
                'tenant' => request()->user()?->tenant->name,
                'request' => json_encode(request()->toArray()),
            ];
        };
    }
}
LOG_GOOGLE_CHAT_NOTIFY_USER_ID_DEFAULT=all