Laravel Error handling using Larax

When you work on any project , whether it staging or production , and your project must be available all the time, so there should be a way to know what errors are occurring in the project in real time.

- Larax

  • Larax is laravel package help us to log exceptions happened in our laravel applications and notify us with all the data we need to find out the cause of the problem when exception happened such as (data user sent it in body, headers ,user ip , user id and his guard) .

- How to Install Larax

  • larax repo in github
'providers' => [
  • Publish larax config file
    Run php artisan vendor:publish --tag=larax-config
use Escode\Larax\ExceptionHandler;
class Handler extends ExceptionHandler

- How to configure Larax

  • open “/config/larax.php” file

You can set your middleware that’s allow to access exceptions pages on website


You can set your middleware that’s allow to access exceptions pages over api


You can control data will be saved when exception happened


You can told Larax to detect user and save his id and his guard with exception data

/Note: if you enable detect user in exception larax will push StartSession::class and EncryptCookies::class in $middleware Kernel.php to can read cookie and session
//and you should be comment StartSession::class from $middlewareGroups => web

You can ignore some keys “remove it from headers data” from request headers such as “Authorization”


You can ignore some fields “remove it from body data” from request body or query string such as “password , image , token”


You can told larax to notify you by send email when exception happened or not.


- How to use Larax

If you follow installation steps larax now can fetch exception happened in your application.
Open “http://localhost:8000/larax/exceptions" to see the exceptions did happened in your application.

  • You can do some filters in your exceptions with date and time range or solved/un-solved or search by user ip or user id
Larax Exception Index Page
Larax Exception exception data

i'm full stack software engineer and web pentester, i love programing and ethical hacking , interested in developing web applications and databases