PHPackages                             corpus/http - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. corpus/http

ActiveLibrary[HTTP &amp; Networking](/categories/http)

corpus/http
===========

HTTP Status Codes and Exceptions

v1.2.0(1y ago)04.1kMITPHPPHP ^7.3 | ^8.0CI passing

Since Dec 21Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/CorpusPHP/Http)[ Packagist](https://packagist.org/packages/corpus/http)[ RSS](/packages/corpus-http/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (5)Versions (6)Used By (0)

Http
====

[](#http)

[![Latest Stable Version](https://camo.githubusercontent.com/455e238ba1bc37c0a3d408ebad7aed269b21074a35a995b59cfbde6b24b7a5a0/68747470733a2f2f706f7365722e707567782e6f72672f636f727075732f687474702f76657273696f6e)](https://packagist.org/packages/corpus/http)[![License](https://camo.githubusercontent.com/f228b3a1766e467a15efe004f5e78dafce7ab1fadbb65edd6a0faab84b6067a8/68747470733a2f2f706f7365722e707567782e6f72672f636f727075732f687474702f6c6963656e7365)](https://packagist.org/packages/corpus/http)[![ci.yml](https://github.com/CorpusPHP/Http/actions/workflows/ci.yml/badge.svg)](https://github.com/CorpusPHP/Http/actions/workflows/ci.yml)

HTTP Status Codes and Exceptions

Requirements
------------

[](#requirements)

- **php**: ^7.4 || ^8.0

Installing
----------

[](#installing)

Install the latest version with:

```
composer require 'corpus/http'
```

Documentation
-------------

[](#documentation)

### Class: Corpus\\Http\\Exceptions\\AbstractHttpException

[](#class-corpushttpexceptionsabstracthttpexception)

Base Exception class all HTTP Exception Classes Extend

#### Method: AbstractHttpException-&gt;\_\_construct

[](#method-abstracthttpexception-__construct)

```
function __construct([ $message = '' [, ?\Throwable $previous = null]])
```

Construct the \*HttpException.

Use the HTTP Status code as the base exceptions code.

##### Parameters:

[](#parameters)

- ***string*** `$message`

---

#### Method: AbstractHttpException-&gt;getHttpStatusCode

[](#method-abstracthttpexception-gethttpstatuscode)

```
function getHttpStatusCode() : int
```

Get the HTTP Status Code the Exception Represents

### Class: Corpus\\Http\\Exceptions\\ClientError\\AbstractClientErrorException

[](#class-corpushttpexceptionsclienterrorabstractclienterrorexception)

Base of Exceptions Representing The 4xx Class

#### Method: AbstractClientErrorException-&gt;\_\_construct

[](#method-abstractclienterrorexception-__construct)

```
function __construct([ $message = '' [, ?\Throwable $previous = null]])
```

Construct the \*HttpException.

Use the HTTP Status code as the base exceptions code.

##### Parameters:

[](#parameters-1)

- ***string*** `$message`

---

#### Method: AbstractClientErrorException-&gt;getHttpStatusCode

[](#method-abstractclienterrorexception-gethttpstatuscode)

```
function getHttpStatusCode() : int
```

Get the HTTP Status Code the Exception Represents

### Class: Corpus\\Http\\Exceptions\\ClientError\\BadRequestException

[](#class-corpushttpexceptionsclienterrorbadrequestexception)

#### Method: BadRequestException-&gt;getHttpStatusCode

[](#method-badrequestexception-gethttpstatuscode)

```
function getHttpStatusCode() : int
```

Get the HTTP Status Code the Exception Represents

---

#### Method: BadRequestException-&gt;\_\_construct

[](#method-badrequestexception-__construct)

```
function __construct([ $message = '' [, ?\Throwable $previous = null]])
```

Construct the \*HttpException.

Use the HTTP Status code as the base exceptions code.

##### Parameters:

[](#parameters-2)

- ***string*** `$message`

### Class: Corpus\\Http\\Exceptions\\ClientError\\ForbiddenException

[](#class-corpushttpexceptionsclienterrorforbiddenexception)

#### Method: ForbiddenException-&gt;getHttpStatusCode

[](#method-forbiddenexception-gethttpstatuscode)

```
function getHttpStatusCode() : int
```

Get the HTTP Status Code the Exception Represents

---

#### Method: ForbiddenException-&gt;\_\_construct

[](#method-forbiddenexception-__construct)

```
function __construct([ $message = '' [, ?\Throwable $previous = null]])
```

Construct the \*HttpException.

Use the HTTP Status code as the base exceptions code.

##### Parameters:

[](#parameters-3)

- ***string*** `$message`

### Class: Corpus\\Http\\Exceptions\\ClientError\\NotFoundException

[](#class-corpushttpexceptionsclienterrornotfoundexception)

#### Method: NotFoundException-&gt;getHttpStatusCode

[](#method-notfoundexception-gethttpstatuscode)

```
function getHttpStatusCode() : int
```

Get the HTTP Status Code the Exception Represents

---

#### Method: NotFoundException-&gt;\_\_construct

[](#method-notfoundexception-__construct)

```
function __construct([ $message = '' [, ?\Throwable $previous = null]])
```

Construct the \*HttpException.

Use the HTTP Status code as the base exceptions code.

##### Parameters:

[](#parameters-4)

- ***string*** `$message`

### Class: Corpus\\Http\\Exceptions\\ClientError\\TooManyRequestsException

[](#class-corpushttpexceptionsclienterrortoomanyrequestsexception)

#### Method: TooManyRequestsException-&gt;getHttpStatusCode

[](#method-toomanyrequestsexception-gethttpstatuscode)

```
function getHttpStatusCode() : int
```

Get the HTTP Status Code the Exception Represents

---

#### Method: TooManyRequestsException-&gt;\_\_construct

[](#method-toomanyrequestsexception-__construct)

```
function __construct([ $message = '' [, ?\Throwable $previous = null]])
```

Construct the \*HttpException.

Use the HTTP Status code as the base exceptions code.

##### Parameters:

[](#parameters-5)

- ***string*** `$message`

### Class: Corpus\\Http\\Exceptions\\ClientError\\UnauthorizedException

[](#class-corpushttpexceptionsclienterrorunauthorizedexception)

#### Method: UnauthorizedException-&gt;getHttpStatusCode

[](#method-unauthorizedexception-gethttpstatuscode)

```
function getHttpStatusCode() : int
```

Get the HTTP Status Code the Exception Represents

---

#### Method: UnauthorizedException-&gt;\_\_construct

[](#method-unauthorizedexception-__construct)

```
function __construct([ $message = '' [, ?\Throwable $previous = null]])
```

Construct the \*HttpException.

Use the HTTP Status code as the base exceptions code.

##### Parameters:

[](#parameters-6)

- ***string*** `$message`

### Class: Corpus\\Http\\Exceptions\\Redirection\\AbstractLocationRedirectionHttpException

[](#class-corpushttpexceptionsredirectionabstractlocationredirectionhttpexception)

Base of 3xx Exceptions which include a "Location" header.

#### Method: AbstractLocationRedirectionHttpException-&gt;\_\_construct

[](#method-abstractlocationredirectionhttpexception-__construct)

```
function __construct(string $location [, string $message = '' [, ?\Throwable $previous = null]])
```

AbstractRedirectionHttpException constructor.

Construct the \*HttpException.

Use the HTTP Status code as the base exceptions code.

##### Parameters:

[](#parameters-7)

- ***\\Throwable*** | ***null*** `$previous` - \[optional\] The previous throwable used for the exception chaining.

---

#### Undocumented Method: `AbstractLocationRedirectionHttpException->getLocation()`

[](#undocumented-method-abstractlocationredirectionhttpexception-getlocation)

---

#### Method: AbstractLocationRedirectionHttpException-&gt;getHttpStatusCode

[](#method-abstractlocationredirectionhttpexception-gethttpstatuscode)

```
function getHttpStatusCode() : int
```

Get the HTTP Status Code the Exception Represents

### Class: Corpus\\Http\\Exceptions\\Redirection\\AbstractRedirectionHttpException

[](#class-corpushttpexceptionsredirectionabstractredirectionhttpexception)

Base of Exceptions Representing The 3xx Class

#### Method: AbstractRedirectionHttpException-&gt;\_\_construct

[](#method-abstractredirectionhttpexception-__construct)

```
function __construct([ $message = '' [, ?\Throwable $previous = null]])
```

Construct the \*HttpException.

Use the HTTP Status code as the base exceptions code.

##### Parameters:

[](#parameters-8)

- ***string*** `$message`

---

#### Method: AbstractRedirectionHttpException-&gt;getHttpStatusCode

[](#method-abstractredirectionhttpexception-gethttpstatuscode)

```
function getHttpStatusCode() : int
```

Get the HTTP Status Code the Exception Represents

### Class: Corpus\\Http\\Exceptions\\Redirection\\FoundException

[](#class-corpushttpexceptionsredirectionfoundexception)

#### Method: FoundException-&gt;getHttpStatusCode

[](#method-foundexception-gethttpstatuscode)

```
function getHttpStatusCode() : int
```

Get the HTTP Status Code the Exception Represents

---

#### Method: FoundException-&gt;\_\_construct

[](#method-foundexception-__construct)

```
function __construct(string $location [, string $message = '' [, ?\Throwable $previous = null]])
```

AbstractRedirectionHttpException constructor.

Construct the \*HttpException.

Use the HTTP Status code as the base exceptions code.

##### Parameters:

[](#parameters-9)

- ***\\Throwable*** | ***null*** `$previous` - \[optional\] The previous throwable used for the exception chaining.

---

#### Undocumented Method: `FoundException->getLocation()`

[](#undocumented-method-foundexception-getlocation)

### Class: Corpus\\Http\\Exceptions\\Redirection\\SeeOtherException

[](#class-corpushttpexceptionsredirectionseeotherexception)

#### Method: SeeOtherException-&gt;getHttpStatusCode

[](#method-seeotherexception-gethttpstatuscode)

```
function getHttpStatusCode() : int
```

Get the HTTP Status Code the Exception Represents

---

#### Method: SeeOtherException-&gt;\_\_construct

[](#method-seeotherexception-__construct)

```
function __construct(string $location [, string $message = '' [, ?\Throwable $previous = null]])
```

AbstractRedirectionHttpException constructor.

Construct the \*HttpException.

Use the HTTP Status code as the base exceptions code.

##### Parameters:

[](#parameters-10)

- ***\\Throwable*** | ***null*** `$previous` - \[optional\] The previous throwable used for the exception chaining.

---

#### Undocumented Method: `SeeOtherException->getLocation()`

[](#undocumented-method-seeotherexception-getlocation)

### Class: Corpus\\Http\\Exceptions\\ServerError\\AbstractServerErrorException

[](#class-corpushttpexceptionsservererrorabstractservererrorexception)

Base of Exceptions Representing The 5xx Class

#### Method: AbstractServerErrorException-&gt;\_\_construct

[](#method-abstractservererrorexception-__construct)

```
function __construct([ $message = '' [, ?\Throwable $previous = null]])
```

Construct the \*HttpException.

Use the HTTP Status code as the base exceptions code.

##### Parameters:

[](#parameters-11)

- ***string*** `$message`

---

#### Method: AbstractServerErrorException-&gt;getHttpStatusCode

[](#method-abstractservererrorexception-gethttpstatuscode)

```
function getHttpStatusCode() : int
```

Get the HTTP Status Code the Exception Represents

### Class: Corpus\\Http\\Exceptions\\ServerError\\InternalServerErrorException

[](#class-corpushttpexceptionsservererrorinternalservererrorexception)

#### Method: InternalServerErrorException-&gt;getHttpStatusCode

[](#method-internalservererrorexception-gethttpstatuscode)

```
function getHttpStatusCode() : int
```

Get the HTTP Status Code the Exception Represents

---

#### Method: InternalServerErrorException-&gt;\_\_construct

[](#method-internalservererrorexception-__construct)

```
function __construct([ $message = '' [, ?\Throwable $previous = null]])
```

Construct the \*HttpException.

Use the HTTP Status code as the base exceptions code.

##### Parameters:

[](#parameters-12)

- ***string*** `$message`

### Class: Corpus\\Http\\Exceptions\\Success\\AbstractSuccessException

[](#class-corpushttpexceptionssuccessabstractsuccessexception)

Base of Exceptions Representing The 2xx Class

#### Method: AbstractSuccessException-&gt;\_\_construct

[](#method-abstractsuccessexception-__construct)

```
function __construct([ $message = '' [, ?\Throwable $previous = null]])
```

Construct the \*HttpException.

Use the HTTP Status code as the base exceptions code.

##### Parameters:

[](#parameters-13)

- ***string*** `$message`

---

#### Method: AbstractSuccessException-&gt;getHttpStatusCode

[](#method-abstractsuccessexception-gethttpstatuscode)

```
function getHttpStatusCode() : int
```

Get the HTTP Status Code the Exception Represents

### Class: Corpus\\Http\\Exceptions\\Success\\NoContentException

[](#class-corpushttpexceptionssuccessnocontentexception)

#### Method: NoContentException-&gt;getHttpStatusCode

[](#method-nocontentexception-gethttpstatuscode)

```
function getHttpStatusCode() : int
```

Get the HTTP Status Code the Exception Represents

---

#### Method: NoContentException-&gt;\_\_construct

[](#method-nocontentexception-__construct)

```
function __construct([ $message = '' [, ?\Throwable $previous = null]])
```

Construct the \*HttpException.

Use the HTTP Status code as the base exceptions code.

##### Parameters:

[](#parameters-14)

- ***string*** `$message`

### Class: Corpus\\Http\\Status

[](#class-corpushttpstatus)

```
