README

This is a very simple library that aims to aid verbosity in any Web-based application by defining clearly the HTTP 1.1 response codes as constants. It includes two main components: an interface, which contains the constants, and an exception specifically for HTTP.

This may be beneficial in an abstract class, so that child classes don't need to explicitly use the interface.

There are various "helper" interfaces within the library, such as WebDAV and Http. Additionally, the various status codes are split into the RFCs that defined them: the Http helper interface extends RFCs 2616, 2324, and 2774, for example. This allows you very granular control of what status codes you want to allow within your application.

All constants have doc blocks that use the official W3C and IETF draft specification descriptions of the status code, to aid IDEs and for reference.

Using the HttpException

The HttpException is very straightforward. It simply is a named exception to aid verbosity:

<?phpuseTeapot\HttpException;useTeapot\StatusCode;thrownewHttpException('Sorry this page does not exist!',StatusCode::NOT_FOUND);

The exception itself uses the StatusCode interface, allowing you to avoid manually and explicitly importing it if you prefer:

<?phpuseTeapot\HttpException;thrownewHttpException('Sorry this page does not exist!',HttpException::NOT_FOUND);