https://github.com/slavcodev/middleware-whoops
This package contains a middleware that catches all exceptions and redirects those to the Whoops error handling library.
https://github.com/slavcodev/middleware-whoops
Last synced: 4 months ago
JSON representation
This package contains a middleware that catches all exceptions and redirects those to the Whoops error handling library.
- Host: GitHub
- URL: https://github.com/slavcodev/middleware-whoops
- Owner: slavcodev
- License: bsd-2-clause
- Created: 2017-01-17T19:40:21.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-17T20:04:38.000Z (over 8 years ago)
- Last Synced: 2025-02-15T08:49:59.343Z (4 months ago)
- Language: PHP
- Size: 3.91 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Whoops middleware
This package contains a middleware that catches all exceptions
and redirects those to the [Whoops error handling library](http://filp.github.io/whoops/).## Install
Via [Composer](https://getcomposer.org)
```bash
composer require phpsdk/middleware-whoops
```## Usage
Just use the `ClientMiddleware` or `ServerMiddleware` class in your middleware stack:
~~~php
use PhpSDK\Http\Middleware\Whoops\ServerMiddleWare as WhoopsServerMiddleWare;
use Whoops;$whoops = new Whoops\Run();
$whoops->pushHandler(new PrettyPageHandler());$middleware = new WhoopsServerMiddleWare($whoops, new Response('Default error', 500));
$stack = $stack->withMiddleware($middleware);
~~~If an exception is thrown, or an error is raised, Whoops will display a nice error message:

## Testing
```bash
# install required files
composer self-update
composer install# run the test (from project root)
phpunit
```## Credits
- [Veaceslav Medvedev](https://github.com/slavcodev)
- [All Contributors](../../contributors)## License
The BSD 2-Clause License. Please see [LICENSE][link-license] for more information.