1. Go to this page and download the library: Download darshan/exceptionemail 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/ */
darshan / exceptionemail example snippets
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Throwable;
class ExceptionServiceProvider extends ServiceProvider
{
public function register()
{
// Nothing here for now.
}
public function boot()
{
app()->error(function (Throwable $e) {
app('exceptionemail')->captureException($e);
});
}
}
return [
// Other service providers...
App\Providers\ExceptionServiceProvider::class,
],
use Throwable;
public function report(Throwable $exception)
{
app('exceptionemail')->captureException($exception);
parent::report($exception);
}
public function report(Exception $exception)
{
if ($this->shouldReport($exception)) {
app('exceptionemail')->captureException($exception);
}
parent::report($exception);
}