Whoops middleware for StackPHP
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:
WhoopsMiddleWare constructor accepts 3 parameters:
public function __construct(HttpKernelInterface $router, $catchExceptions = true, $catchErrors = true);
- $router: this is the next router to be called on the Stack
- $catchExceptions: Set to true to catch exception. Set to false to ignore exceptions (for production servers)
- $catchErrors: Set to true to catch raised errors. Set to false to ignore raised errors (for production servers)
$catchErrors can be passed a boolean, a callable (that returns a boolean) or a ConditionInterface that evaluates to true or false.
Found a typo? Something is wrong in this documentation? Just fork and edit it!