Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bart's avatar

It is simple markdown here in the Laracasts forum which is Github-flavored IMO. You can add code snippets using this style by beginning and ending with three apostrophes. ```YOUR CODE GOES HERE```

NeoNe's avatar

I find a simple solution at Jens Segers blog just install whoops via composer

   composer require filp/whoops

And change render method inside app/Exceptions/Handler.php don't need to edit anything else


/**
 * Render an exception into an HTTP response.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  \Exception  $e
 * @return \Illuminate\Http\Response
 */
public function render($request, Exception $e)
{
    if (config('app.debug'))
    {
        $whoops = new \Whoops\Run;

        if ($request->ajax())
        {
            $whoops->pushHandler(new \Whoops\Handler\JsonResponseHandler);
        }
        else
        {
            $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
        }

        return response($whoops->handleException($e),
            $e->getStatusCode(),
            $e->getHeaders()
        );
    }

    return parent::render($request, $e);
}

2 likes
DomRaymond's avatar

I'm new to the Laravel world but a 15 year veteran of web development. Love the Framework and it will most likely become a choice on some of my new projects. My 2 cents on this issue and version 5 though... if Whoops and FormBuilder are to be considered "add-ons", they should not be presented in the 15 tutorials about Laravel 5 posted on YouTube. My learning curve was accentuated because I did not understand why my error reporting looked different from what I was seeing in the videos AND when I started researching about the FormBuilder add-on, I could not find any documentation about Laravel 5 add-ons... it unfortunately left me with a feeling that there is a maturity level that is missing in Laravel. It also made me question all the beautiful hype about simplicity and elegance. Anyway, please take this as constructive criticism because for the most part, I believe you guys are getting many things right.

2 likes
JeffreyWay's avatar

@DomRaymond - A couples notes for you:

  1. I don't have any Laravel 5 videos on YouTube. So you were watching videos that were illegally uploaded without my permission.
  2. You were also watching an archived series.
  3. The up-to-date Laravel 5 series here at Laracasts (which is also free) reflects the fact that Whoops and the form builder are no longer part of core. https://laracasts.com/series/laravel-5-fundamentals
1 like
igorsantos07's avatar

I got here while trying to understand WTH my Laravel project is displaying a WSOD even though debug is correctly configured - it seems Laravel is overwriting the php.ini settings.

Anyways, this long post got me wondering what's needed for a component to be considered "part of the framework". As far as I can see, we are indeed building web applications with Laravel, mostly. So why would the HTML/Form component be thrown to the community to take care of? This is the only big framework that I've used until now that does not sport HTML facilities. It makes no sense at all. Meanwhile, you see rarely used components like Schedule, Billing or SSH being officially supported - some of those being even included in the core. I would really, really like to understand why such weird decisions have been taken. As said by many others, this type of "lack of support" only makes matters worse for newbies, as we have a hard time fiddling with Google before being able to do stuff like creating forms based on models. Why some components are optional but others have been completely abandoned?

gildniy's avatar

I use this in my project (L5.2.x) :

/**
 * Render an exception into an HTTP response.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  \Exception  $e
 * @return \Illuminate\Http\Response
 */
public function render($request, Exception $e)
{
    if ($this->isHttpException($e))
    {
        return $this->renderHttpException($e);
    }

    if (config('app.debug'))
    {
        return $this->renderExceptionWithWhoops($e);
    }

    return parent::render($request, $e);
}

/**
 * Render an exception using Whoops.
 *
 * @param  \Exception $e
 * @return \Illuminate\Http\Response
 */
protected function renderExceptionWithWhoops(Exception $e)
{
    $whoops = new \Whoops\Run;
    $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());

    return new \Illuminate\Http\Response(
        $whoops->handleException($e),
        $e->getStatusCode(),
        $e->getHeaders()
    );
}

Thanks!

Previous

Please or to participate in this conversation.