PHP code example of ebrigham1 / cakephp-error-email
1. Go to this page and download the library: Download ebrigham1/cakephp-error-email 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/ */
namespace App\Error;
use App\Traits\EmailThrowableTrait;
use ErrorEmail\Error\ErrorHandler as ErrorEmailErrorHandler;
class ErrorHandler extends ErrorEmailErrorHandler
{
use EmailThrowableTrait;
}
namespace App\Middleware;
use App\Traits\EmailThrowableTrait;
use ErrorEmail\Middleware\ErrorHandlerMiddleware as ErrorEmailErrorHandlerMiddleware;
class ErrorHandlerMiddleware extends ErrorEmailErrorHandlerMiddleware
{
use EmailThrowableTrait;
}
use Cake\Error\ErrorHandler; // Or use ErrorEmail\Error\ErrorHandler;
use App\Error\ErrorHandler;
use Cake\Error\Middleware\ErrorHandlerMiddleware; // Or use ErrorEmail\Middleware\ErrorHandlerMiddleware;
use App\Middleware\ErrorHandlerMiddleware;
protected function _appSpecificSkipEmail($throwable)
{
// Add any logic here to skip emailing throwables that }
protected function _appSpecificSkipThrottle($throwable)
{
// Add any logic here to skip throttling throwables that
protected function _setupEmail(\Cake\Mailer\Email $email, $throwable)
{
// Add logic here to pick the email template, layout,
// set the to address, from address, viewVars, ect.
// Make sure to return your email object at the end of the function
// so the plugin can send the email.
return $email;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.