for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Magister\Services\Exception;
use Magister\Services\Support\ServiceProvider;
use Whoops\Handler\JsonResponseHandler;
use Whoops\Handler\PrettyPageHandler;
use Whoops\Run;
/**
* Class ExceptionServiceProvider.
*/
class ExceptionServiceProvider extends ServiceProvider
{
* Register bindings in the container.
*
* @return void
public function register()
if (class_exists('Whoops\Run')) {
$this->registerPrettyWhoopsHandler();
$this->registerWhoops();
}
* Register the Whoops error display service.
protected function registerWhoops()
// We will instruct Whoops to not exit after it displays the exception as it
// will otherwise run out before we can do anything else. We just want to
// let the framework go ahead and finish a request on this end instead.
with($whoops = new Run)->allowQuit(false);
$whoops->pushHandler($this->app['whoops.handler']);
$whoops->register();
* Register the "pretty" Whoops handler.
protected function registerPrettyWhoopsHandler()
$this->app['whoops.handler'] = $this->app->share(function()
with($handler = new PrettyPageHandler)->setEditor('sublime');
return $handler;
});