PHP code example of hugomyb / filament-error-mailer

1. Go to this page and download the library: Download hugomyb/filament-error-mailer 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/ */

    

hugomyb / filament-error-mailer example snippets


$schedule->call(function () {
    $storagePath = config('error-mailer.storage_path');
    $files = File::files($storagePath);

    foreach ($files as $file) {
        if ($file->getMTime() < now()->subMonths(3)->timestamp) {
            File::delete($file->getRealPath());
        }
    }
})->daily();

return [
    'email' => [
        'recipient' => ['[email protected]'],
        'bcc' => [],
        'cc' => [],
        'subject' => 'An error has occurred - ' . env('APP_NAME'),
    ],

    'disabledOn' => [
        //
    ],

    'cacheCooldown' => 10, // in minutes

    'webhooks' => [
        'discord' => env('ERROR_MAILER_DISCORD_WEBHOOK'),

        'message' => [
            'title' => 'Error Alert - ' . env('APP_NAME'),
            'description' => 'An error has occured in the application.',
            'error' => 'Error',
            'file' => 'File',
            'line' => 'Line',
            'details_link' => 'See more details'
        ],
    ],
    
    'storage_path' => storage_path('app/errors'),
];

'disabledOn' => [
    'local',
],

...
->plugins([
    FilamentErrorMailerPlugin::make()
])
bash
php artisan vendor:publish --tag="error-mailer-config"
bash
php artisan vendor:publish --tag="error-mailer-views"