marlonapp / marlon-lumen by danieletulone

118
0
0
Package Data
Maintainer Username: danieletulone
Maintainer Contact: danieletulone.work@gmail.com (danieletulone)
Package Create Date: 2021-03-11
Package Last Update: 2021-06-21
Home Page:
Language: PHP
License: Unknown
Last Refreshed: 2024-12-24 15:08:16
Package Statistics
Total Downloads: 118
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 0
Total Forks: 0
Total Open Issues: 0

Marlon Lumen

## Usage

  1. Register provider into bootstrap/app.php:

    $app->register(Marlon\Lumen\Providers\MarlonLumenServiceProvider::class);
    
  2. Add ErrorHandler trait to app/Exceptions/Handler.php:

    
    namespace App\Exceptions;
    
    use Illuminate\Auth\Access\AuthorizationException;
    use Illuminate\Database\Eloquent\ModelNotFoundException;
    use Illuminate\Validation\ValidationException;
    use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
    use Marlon\Lumen\ErrorHandler;
    use Symfony\Component\HttpKernel\Exception\HttpException;
    use Throwable;
    
    class Handler extends ExceptionHandler
    {
        use ErrorHandler;
    
        /**
        * A list of the exception types that should not be reported.
        *
        * @var array
        */
        protected $dontReport = [
            AuthorizationException::class,
            HttpException::class,
            ModelNotFoundException::class,
            ValidationException::class,
        ];
    
        /**
        * Report or log an exception.
        *
        * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
        *
        * @param  \Throwable  $exception
        * @return void
        *
        * @throws \Exception
        */
        public function report(Throwable $exception)
        {
            parent::report($exception);
        }
    }