Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
How to get filp/whoops to work in Laravel 5.2 or 5.3 - Add this code to your `App\Exceptions\Handler.php` file.
/**
* Create a Symfony response for the given exception.
*
* @param \Exception $e
* @return mixed
*/
protected function convertExceptionToResponse(Exception $e)
{
if (config('app.debug')) {
$whoops = new \Whoops\Run;
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
return response()->make(
$whoops->handleException($e),
method_exists($e, 'getStatusCode') ? $e->getStatusCode() : 500,
method_exists($e, 'getHeaders') ? $e->getHeaders() : []
);
}
return parent::convertExceptionToResponse($e);
}
@jakelacey2012

This comment has been minimized.

Show comment Hide comment
@jakelacey2012

jakelacey2012 Oct 9, 2016

👍

👍

@topegret

This comment has been minimized.

Show comment Hide comment
@topegret

topegret Oct 15, 2016

good. thanks!

good. thanks!

@uchsarath

This comment has been minimized.

Show comment Hide comment
@uchsarath

uchsarath Oct 25, 2016

This works really well on 5.3. 1+

uchsarath commented Oct 25, 2016

This works really well on 5.3. 1+

@pilot911

This comment has been minimized.

Show comment Hide comment
@pilot911

pilot911 Dec 3, 2016

Thanks! Nice work with Laravel core AuthenticationException

pilot911 commented Dec 3, 2016

Thanks! Nice work with Laravel core AuthenticationException

@sarmenhb

This comment has been minimized.

Show comment Hide comment
@sarmenhb

sarmenhb Jan 12, 2017

thanks, i hate the default error on laravel 5.3 its super confusing.

thanks, i hate the default error on laravel 5.3 its super confusing.

@sakibbuddy

This comment has been minimized.

Show comment Hide comment
@sakibbuddy

sakibbuddy Aug 17, 2017

Nice Work!

Nice Work!

@geniusrim

This comment has been minimized.

Show comment Hide comment
@geniusrim

geniusrim Sep 26, 2017

Is this work on 5.4? When I use this into test environment it works and the laravel version is 5.4. And I use this to my work environment it doesn't work and the laravel version is 5.4.
And if not how I can use in 5.4?
I really like this so I really want to use in 5.4 :(

geniusrim commented Sep 26, 2017

Is this work on 5.4? When I use this into test environment it works and the laravel version is 5.4. And I use this to my work environment it doesn't work and the laravel version is 5.4.
And if not how I can use in 5.4?
I really like this so I really want to use in 5.4 :(

@devCLT

This comment has been minimized.

Show comment Hide comment
@devCLT

devCLT Oct 2, 2017

Thanks Alex! I'm using Laravel 5.4.30 (PHP 5.6.30 and Apache ) and it works for me. FYI: After the composer require filp/whoops completed, the messages in my command window mentioned I might want to also require whoops/soap so I also did that....doubt it matters to work on 5.4 but just in case.

devCLT commented Oct 2, 2017

Thanks Alex! I'm using Laravel 5.4.30 (PHP 5.6.30 and Apache ) and it works for me. FYI: After the composer require filp/whoops completed, the messages in my command window mentioned I might want to also require whoops/soap so I also did that....doubt it matters to work on 5.4 but just in case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment