Home

Awesome

Whoops middleware for StackPHP

This package contains a StackPHP middleware that catches all exceptions and redirects those to the Whoops error handling library.

Installation

Through Composer as mouf/whoops-stackphp.

Usage

Simply use the WhoopsMiddleWare class in your middleware stack:

use Whoops\StackPhp\WhoopsMiddleWare;

$router = new WhoopsMiddleWare(
	new MyOtherRouter(
		new YetAnotherRouter()));

If an exception is thrown, or an error is raised, Whoops will display a nice error message:

Sample error screen

The WhoopsMiddleWare constructor accepts 3 parameters:

public function __construct(HttpKernelInterface $router, $catchExceptions = true, $catchErrors = true);

Note: $catchExceptions and $catchErrors can be passed a boolean, a callable (that returns a boolean) or a ConditionInterface that evaluates to true or false.