Search code examples
phplaravelphpstorm

How open file in PhpStorm by clicking on backtrace line on error page in browser


When occurs error in code, browser displays error page with backtrace:

enter image description here

Is it possible to open file in PhpStorm by clicking on line with error?


Solution

  • Use next approach: copy two files from this project into your Laravel project:

    • app/Exceptions/Handler.php (override ExceptionHandler::render() to call modified view of error page)
    • resources/views/errors/error.blade.php (modified view of error page)

    So, your error page will looks like: enter image description here

    When you click on "Go to line" link, file with this line opens in PhpStorm.