PHP code example of confetticode / laravel-log-mail

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

    

confetticode / laravel-log-mail example snippets




return [
    // ...
    'channels' => [
        'mail' => [
            'driver' => 'mail',
            'mailer' => env('LOG_MAIL_MAILER'),
            'name' => env('LOG_MAIL_NAME'),
            'level' => env('LOG_MAIL_LEVEL'),
            'bubble' => env('LOG_MAIL_BUBBLE'),
            'from' => [
                'address' => env('LOG_MAIL_FROM_ADDRESS'),
                'name' => env('LOG_MAIL_FROM_NAME'),
            ],
            'to' => [
                'address' => env('LOG_MAIL_TO_ADDRESS'),
                'name' => env('LOG_MAIL_TO_NAME'),
            ],
        ],
    ],
    // ...
];




use Illuminate\Support\Facades\Log;

try {
    new UndefinedClass;
} catch (\Throwable $e) {
    Log::channel('mail')->error($e->getMessage(), ['exception' => $e]);
}
plain
LOG_STACK=daily,mail