Last Updated | | Ratings | | Unique User Downloads | | Download Rankings |
2020-10-23 (4 months ago) | | Not yet rated by the users | | Total: 19 | | All time: 10,189 This week: 342 |
|
Description | | Author |
This package provides an exception class to use in REST APIs applications.
It extends the base PHP Exception class to take parameters with values about the current HTTP request in order to provide more context information about the conditions that may trigger an exception.
Besides the exception code and exception message that is expected by the base PHP Exception class, it can also take parameters for the HTTP status code, HTTP request body and request URL. Innovation Award
February 2021
Nominee
Vote |
Exceptions are special kind of class that is useful to pass details of errors that may happen within an application.
Usually exception classes carry information about the errors that includes an error message and an error code that can be useful to help applications to treat the errors in a a more convenient way for its users.
This package extends the information that is usually stored in an exception class. It adds details like the HTTP status code, request body and request URL, which may be useful for instance to generate error logs for applications that implement APIs.
Manuel Lemos |
| |
|
|
Innovation award
Nominee: 6x |
|
Details
REST Exception
Installation
Just type
composer require mezon/rest-exception
Usage
To use this class is very simple thing:
throw(new \Mezon\Rest\Exception(
"", // message of the exception, like in the standard Exception class
-1, // code of the exception, like in the standard Exception class
200, // HTTP code of the request
"<p>Warning!" // HTTP request body
));
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.