controlabs / http-exceptions
This package is abandoned and no longer maintained.
No replacement package was suggested.
PHP HTTP Status Code Exceptions
v1.1
2018-11-06 18:14 UTC
Requires
- php: ^7.1
Requires (Dev)
- phpstan/phpstan: ^0.10.3
- phpunit/phpunit: ^7
This package is auto-updated.
Last update: 2024-11-07 07:44:34 UTC
README
PHP HTTP Exceptions
Installation
composer require controlabs/http-exceptions
Usage
use Controlabs\Http\Exception\BadRequest;
Throws an Bad Request exception:
throw new BadRequest();
Throws an exception with a custom message:
throw new BadRequest("I'm gonna make him an offer he can't refuse.");
Response (it can return in JSON or ARRAY format):
try { } catch (BadRequest $e) { $e->response()->toArray(); // or $e->response()->toJson(); }
License
This software is open source, licensed under the The MIT License (MIT). See LICENSE for details.