Download the PHP package chiron/http-exceptions without Composer

On this page you can find all versions of the php package chiron/http-exceptions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package http-exceptions

Build Status Coverage Status CodeCov

Total Downloads Monthly Downloads

StyleCI PHP-Eye PHPStan

HttpExceptions

All HTTP statuses from RFC 7231 implemented as separated Exceptions.

These Exceptions support a straightforward implementation of the IETF Problem Details for HTTP APIs RFC 7807.

abstract HttpException class and its subclasses provide exceptions corresponding to HTTP error status codes. The most common are included, but you can create exceptions for other status codes by using (or subclassing) HttpException and providing the reason phrase as the $title and the status code as the $statusCode.

This package provides the following exception classes in the Chiron\Http\Exception\Client namespace for 4xx http errors. And Chiron\Http\Exception\Server namespace for 5xx http errors.

4xx: Client Error - The request contains bad syntax or cannot be fulfilled 5xx: Server Error - The server failed to fulfill an apparently valid request

Client errors :

Exception Code Message
BadRequestHttpException 400 "Bad Request"
UnauthorizedHttpException 401 "Unauthorized"
PaymentRequiredHttpException 402 "Payment Required"
ForbiddenHttpException 403 "Forbidden"
NotFoundHttpException 404 "Not Found"
MethodNotAllowedHttpException 405 "Method Not Allowed"
NotAcceptableHttpException 406 "Not Acceptable"
ProxyAuthenticationRequiredHttpException 407 "Proxy Authentication Required"
RequestTimeoutHttpException 408 "Request Timeout"
ConflictHttpException 409 "Conflict"
GoneHttpException 410 "Gone"
LengthRequiredHttpException 411 "Length Required"
PreconditionFailedHttpException 412 "Precondition Failed"
PayloadTooLargeHttpException 413 "Payload Too Large"
UriTooLongHttpException 414 "URI Too Long"
UnsupportedMediaTypeHttpException 415 "Unsupported Media Type"
RangeNotSatisfiableHttpException 416 "Range Not Satisfiable"
ExpectationFailedHttpException 417 "Expectation Failed"
MisdirectedRequestHttpException 421 "Misdirected Request"
UnprocessableEntityHttpException 422 "Unprocessable Entity"
LockedHttpException 423 "Locked"
FailedDependencyHttpException 424 "Failed Dependency"
TooEarlyHttpException 425 "Too Early"
UpgradeRequiredHttpException 426 "Upgrade Required"
PreconditionRequiredHttpException 428 "Precondition Required"
TooManyRequestsHttpException 429 "Too Many Requests"
RequestHeaderFieldsTooLargeHttpException 431 "Request Header Fields Too Large"
UnavailableForLegalReasonsHttpException 451 "Unavailable For Legal Reasons"

Server errors :

Exception Code Message
InternalServerErrorHttpException 500 "Internal Server Error"
NotImplementedHttpException 501 "'Not Implemented"
BadGatewayHttpException 502 "Bad Gateway"
ServiceUnavailableHttpException 503 "Service Unavailable"
GatewayTimeoutHttpException 504 "Gateway Timeout"
HttpVersionNotSupportedHttpException 505 "HTTP Version Not Supported"
VariantAlsoNegotiatesHttpException 506 "Variant Also Negotiates"
InsufficientStorageHttpException 507 "Insufficient Storage"
LoopDetectedHttpException 508 "Loop Detected"
NotExtendedHttpException 510 "Not Extended"
NetworkAuthenticationRequiredHttpException 511 "Network Authentication Required"

References for HTTP status code

Basic Usage

Throw an exception.

Throw an exception with a custom message.

Catch an exception and output an HTML response.

Or, if you're using PSR7 response :

Api Problem

The following properties are available to use it for API Problem RFC 7807.

And output the API Problem response like this :

For XML output you can use the function $e->toArray() and serialize the data.

Install

Add Chiron/http-exceptions to your composer.json

License

Licensed under the MIT license

Suggestions

Tips : Usage Suggestion


All versions of http-exceptions with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0|^8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package chiron/http-exceptions contains the following files

Loading the files please wait ....