|Ratings|| ||Unique User Downloads|| ||Download Rankings|
|Not yet rated by the users||Total: 63 This week: 1||All time: 10,151 This week: 209|
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.
|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.
composer require mezon/rest-exception
To use this class is very simple thing:
"", // 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.