viewBox="0 0 51 48">Five Pointed Star Five Pointed Star

Adding Whoops back into Laravel 5

Credit to Laracasts Forum

Create a new file ErrorServiceProvider.php under app/Providers/

<?php  
namespace App\Providers;

use Illuminate\Support\ServiceProvider;  
use Whoops\Handler\PrettyPageHandler;  
use Whoops\Run;

class ErrorServiceProvider extends ServiceProvider {

/**
  * Register any error handlers.
  *
  * @return void
  */
    public function boot()
    {
        $whoops = new Run;
        $whoops->pushHandler(new PrettyPageHandler);
        $whoops->register();
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        //
    }

}

add to composer.json

"filp/whoops": "~1.0"

in config/app.php:

'providers' => [

  /*
   * Application Service Providers...
   */
  'App\Providers\EventServiceProvider',
  'App\Providers\RouteServiceProvider',
  'App\Providers\ErrorServiceProvider',

  /*
   * Laravel Framework Service Providers...
   */

  [...]

 ],
composer update  

L. Ball
L. Ball

Father. Developer. Coffee Connoisseur. Amateur Guitarist.