Mezon REST Exception: Exception class to use in REST APIs applications

Recommend this page to a friend!
  Info   View files Documentation   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2020-10-23 (11 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 60 All time: 9,963 This week: 185Up
Version License PHP version Categories
mezon-rest-exception 1.0.0MIT/X Consortium ...5HTTP, PHP 5, Language
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
PHP Programming Innovation award nominee
February 2021
Number 7
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
Picture of Alexey Dodonov
  Performance   Level  
Name: Alexey Dodonov <contact>
Classes: 46 packages by
Country: Russian Federation Russian Federation
Age: ???
All time rank: 213262 in Russian Federation Russian Federation
Week rank: 599 Up22 in Russian Federation Russian Federation Up
Innovation award
Innovation award
Nominee: 8x


REST Exception Build Status codecov


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
  Files folder image Files  
File Role Description
Files folder imageTests (1 file)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Plain text file Exception.php Class Class source
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file Doc. Documentation

  Files folder image Files  /  Tests  
File Role Description
  Plain text file RestExceptionUnitTest.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,963
This week:185Up
For more information send a message to info at phpclasses dot org.