All Projects → middlewares → Whoops

middlewares / Whoops

Licence: mit
PSR-15 middleware to use Whoops as error handler

Projects that are alternatives of or similar to Whoops

Cookie Session
Simple cookie-based session middleware
Stars: ✭ 928 (+3100%)
Mutual labels:  middleware
Middlewares
💥 Middlewares / Relay / PSR-7 support to Nette Framework (@nette)
Stars: ✭ 13 (-55.17%)
Mutual labels:  middleware
Django Login Required Middleware
Requires login to all requests through middleware.
Stars: ✭ 20 (-31.03%)
Mutual labels:  middleware
Wrench
CakePHP 3 Maintenance Mode plugin
Stars: ✭ 26 (-10.34%)
Mutual labels:  middleware
Redux Dynamic Modules
Modularize Redux by dynamically loading reducers and middlewares.
Stars: ✭ 874 (+2913.79%)
Mutual labels:  middleware
Blazar
Pre-Render Pages on the Fly in Laravel
Stars: ✭ 14 (-51.72%)
Mutual labels:  middleware
Kona
a node.js service framework built on koa.js (generators)
Stars: ✭ 23 (-20.69%)
Mutual labels:  middleware
Echo Logrus
echo-logrus is a middleware that provides logrus logger support for echo.
Stars: ✭ 27 (-6.9%)
Mutual labels:  middleware
Carter
Carter is framework that is a thin layer of extension methods and functionality over ASP.NET Core allowing code to be more explicit and most importantly more enjoyable.
Stars: ✭ 875 (+2917.24%)
Mutual labels:  middleware
Gentleman
Full-featured, plugin-driven, extensible HTTP client toolkit for Go
Stars: ✭ 886 (+2955.17%)
Mutual labels:  middleware
Maintenance
Site maintenance SEO PSR-15 middleware
Stars: ✭ 8 (-72.41%)
Mutual labels:  middleware
Await Handler
Basic wrapper for await that allows handling of errors without try/catch blocks
Stars: ✭ 13 (-55.17%)
Mutual labels:  error-handling
Statusprovider
Protocol to handle initial Loadings, Empty Views and Error Handling in a ViewController & views
Stars: ✭ 879 (+2931.03%)
Mutual labels:  error-handling
Gin Stats
Gin's middleware for request stats
Stars: ✭ 24 (-17.24%)
Mutual labels:  middleware
Go Bootstrap
Easy way to bootstrap a web server in Go (Routing|Middleware|Https)
Stars: ✭ 27 (-6.9%)
Mutual labels:  middleware
Logger
HTTP middleware for Go that logs web requests to an io.Writer.
Stars: ✭ 24 (-17.24%)
Mutual labels:  middleware
Shardingsphere Elasticjob
Distributed scheduled job framework
Stars: ✭ 7,369 (+25310.34%)
Mutual labels:  middleware
Adroit
ADR/PSR-7 middleware
Stars: ✭ 28 (-3.45%)
Mutual labels:  middleware
Blog App Buffalo
A blogging app built with Buffalo.
Stars: ✭ 27 (-6.9%)
Mutual labels:  middleware
Grpc Tools
A suite of gRPC debugging tools. Like Fiddler/Charles but for gRPC.
Stars: ✭ 881 (+2937.93%)
Mutual labels:  middleware

middlewares/whoops

Latest Version on Packagist Software License Testing Total Downloads

Middleware to use Whoops as error handler.

Requirements

Installation

This package is installable and autoloadable via Composer as middlewares/whoops.

composer require middlewares/whoops

Example

$dispatcher = new Dispatcher([
    new Middlewares\Whoops()
]);

$response = $dispatcher->dispatch(new ServerRequest());

Usage

The constructor accepts a Whoops\Run instance but creates one automatically if it's not provided. Optionally, you can provide a Psr\Http\Message\ResponseFactoryInterface as the second argument to create the response. If it's not defined, Middleware\Utils\Factory will be used to detect it automatically.

$whoops = new Whoops\Run();
$responseFactory = new MyOwnResponseFactory();

//Create a Run instance automatically
$middleware = new Middlewares\Whoops();

//Pass your own Run instance
$middleware = new Middlewares\Whoops($whoops);

//Pass a Run instance and ResponseFactory
$middleware = new Middlewares\Whoops($whoops, $responseFactory);

catchErrors

To catch not only throwable exceptions, but also php errors. This makes whoops to be registered temporary in order to capture the errors using set_error_handler. It's enabled by default so, to disable it you have to use ->catchErrors(false);

//Do not catch errors
$middleware = (new Middlewares\Whoops())->catchErrors(false);

handlerContainer

This option allows to define a custom PSR-11 container used to create the intance of Whoops\Handler\HandlerInterface based in the Accept header in the request.


Please see CHANGELOG for more information about recent changes and CONTRIBUTING for contributing details.

The MIT License (MIT). Please see LICENSE for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].