Just type
composer require mezon/rest-exception
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 ));
info at phpclasses dot org