PHP code example of shaffe / laravel-mail-log-channel
1. Go to this page and download the library: Download shaffe/laravel-mail-log-channel 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/ */
shaffe / laravel-mail-log-channel example snippets
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['daily', 'mail'],
],
'mail' => [
'driver' => 'mail',
'level' => env('LOG_MAIL_LEVEL', 'error'),
'to' => env('LOG_MAIL_ADDRESS'),
],
],
'mail' => [
'driver' => 'mail',
'level' => 'error',
// Recipients (see formats below)
'to' => env('LOG_MAIL_ADDRESS'),
// Sender (defaults to mail.from config)
'from' => [
'address' => env('LOG_MAIL_FROM_ADDRESS'),
'name' => env('LOG_MAIL_FROM_NAME', 'Errors'),
],
// Subject line pattern
// Placeholders: %level_name%, %message%, %env%, %context%, %app_name%, %channel%, %datetime%
'subject_format' => '[%level_name%] [%env%] %context% — %message%',
// Throttle identical errors (seconds). Set to 0 or false to disable.
'throttle' => 60,
// Cache store for throttle state (null = default store)
'throttle_cache_store' => null,
// Include last N SQL queries in the email
'log_queries' => true,
// Collapse vendor frames in stack trace
'collapse_vendor_frames' => true,
// Custom Mailable class (receives $content and $records)
// 'mailable' => \App\Mail\CustomLogMail::class,
],
// Simple string
'to' => '[email protected] ',
// Multiple addresses
'to' => ['[email protected] ', '[email protected] '],
// With names
'to' => ['[email protected] ' => 'Dev Team'],
// Structured
'to' => [
['address' => '[email protected] ', 'name' => 'Dev Team'],
['address' => '[email protected] ', 'name' => 'Ops'],
],
'to' => [
'default' => '[email protected] ', // fallback for levels not listed
'critical' => '[email protected] ', // critical & emergency → on-call
'emergency' => [
['address' => '[email protected] ', 'name' => 'On-Call'],
['address' => '[email protected] ', 'name' => 'CTO'],
],
'debug' => null, // explicitly suppress debug emails
'info' => '', // same — no email for info
],
use Monolog\Level;
'to' => [
'default' => '[email protected] ',
Level::Critical->value => '[email protected] ', // 500
'warning' => '[email protected] ', // string works too
Level::Debug->value => null, // 100 — suppressed
],
// Throttle window in seconds (default: 60)
'throttle' => 60,
// Disable throttling
'throttle' => 0,
// Use a specific cache store (useful for multi-server setups)
'throttle_cache_store' => 'redis',
'log_queries' => false,
// config/app.php
'editor' => 'phpstorm',
'editor' => [
'href' => 'custom://open?file={file}&line={line}',
],
'editor' => [
'name' => 'phpstorm',
'base_path' => '/local/path/to/project',
],