radweb / tumble
for when it all comes tumbling down...
Installs: 405
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 7
Forks: 0
Open Issues: 0
pkg:composer/radweb/tumble
Requires (Dev)
- illuminate/contracts: ^5.1
- illuminate/http: ^5.1
- illuminate/support: ^5.1
This package is not auto-updated.
Last update: 2025-03-29 20:27:10 UTC
README
Tumble
for when it all comes tumbling down...
A collection of Exceptions roughly mapping to HTTP response status codes.
Also comes with a JSON formatter middleware for Laravel 5.x
Usage
If your entire application serves JSON (i.e. it's entirely an API) you can use this as an application-level Middleware. Add to your Kernel
:
protected $middleware = [ // ... \Radweb\Tumble\FormatExceptionsMiddleware::class, // ... ];
If only a portion of your application serves JSON (i.e. you also have HTML views) you can use this a Route Middleware. Add to your Kernel
:
protected $routeMiddleware = [ // ... 'jsonExceptions' => \Radweb\Tumble\FormatExceptionsMiddleware::class, // ... ];
Then add the Middleware to your routes:
Route::group(['prefix' => '/api', 'middleware' => ['jsonExceptions']], function() { Route::get('/', function() { // ... }); });