Skip to content

Commit 70899e5

Browse files
committed
Merge branch 'feature/1'
Close #1
2 parents 26095c6 + fa16912 commit 70899e5

File tree

3 files changed

+143
-1
lines changed

3 files changed

+143
-1
lines changed

CHANGELOG.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file, in reverse chronological order by release.
4+
5+
## 1.1.0 - 2016-09-19
6+
7+
### Added
8+
9+
- [#1](https://github.com/php-fig/http-message-util/pull/1) adds
10+
`Fig\Http\Message\StatusCodeInterface`, with constants named after common
11+
status reason phrases, with values indicating the status codes themselves.
12+
13+
### Deprecated
14+
15+
- Nothing.
16+
17+
### Removed
18+
19+
- Nothing.
20+
21+
### Fixed
22+
23+
- Nothing.
24+
25+
## 1.0.0 - 2017-08-05
26+
27+
### Added
28+
29+
- Adds `Fig\Http\Message\RequestMethodInterface`, with constants covering the
30+
most common HTTP request methods as specified by the IETF.
31+
32+
### Deprecated
33+
34+
- Nothing.
35+
36+
### Removed
37+
38+
- Nothing.
39+
40+
### Fixed
41+
42+
- Nothing.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"extra": {
2222
"branch-alias": {
23-
"dev-master": "1.0.x-dev"
23+
"dev-master": "1.1.x-dev"
2424
}
2525
}
2626
}

src/StatusCodeInterface.php

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?php
2+
3+
namespace Fig\Http\Message;
4+
5+
/**
6+
* Defines constants for common HTTP status code.
7+
*
8+
* @see https://tools.ietf.org/html/rfc2518#section-9.7
9+
* @see https://tools.ietf.org/html/rfc2295#section-8.1
10+
* @see https://tools.ietf.org/html/rfc2774#section-7
11+
* @see https://tools.ietf.org/html/rfc3229#section-10.4
12+
* @see https://tools.ietf.org/html/rfc4918#section-11
13+
* @see https://tools.ietf.org/html/rfc5842#section-7.1
14+
* @see https://tools.ietf.org/html/rfc5842#section-7.2
15+
* @see https://tools.ietf.org/html/rfc6585#section-3
16+
* @see https://tools.ietf.org/html/rfc6585#section-4
17+
* @see https://tools.ietf.org/html/rfc6585#section-5
18+
* @see https://tools.ietf.org/html/rfc6585#section-6
19+
* @see https://tools.ietf.org/html/rfc7231#section-6
20+
* @see https://tools.ietf.org/html/rfc7238#section-3
21+
* @see https://tools.ietf.org/html/rfc7725#section-3
22+
*
23+
* Usage:
24+
*
25+
* <code>
26+
* class ResponseFactory implements StatusCodeInterface
27+
* {
28+
* public function createResponse($code = self::STATUS_OK)
29+
* {
30+
* }
31+
* }
32+
* </code>
33+
*/
34+
interface StatusCodeInterface
35+
{
36+
//Informational 1xx
37+
const STATUS_CONTINUE = 100;
38+
const STATUS_SWITCHING_PROTOCOLS = 101;
39+
const STATUS_PROCESSING = 102;
40+
//Successful 2xx
41+
const STATUS_OK = 200;
42+
const STATUS_CREATED = 201;
43+
const STATUS_ACCEPTED = 202;
44+
const STATUS_NON_AUTHORITATIVE_INFORMATION = 203;
45+
const STATUS_NO_CONTENT = 204;
46+
const STATUS_RESET_CONTENT = 205;
47+
const STATUS_PARTIAL_CONTENT = 206;
48+
const STATUS_MULTI_STATUS = 207;
49+
const STATUS_ALREADY_REPORTED = 208;
50+
const STATUS_IM_USED = 226;
51+
//Redirection 3xx
52+
const STATUS_MULTIPLE_CHOICES = 300;
53+
const STATUS_MOVED_PERMANENTLY = 301;
54+
const STATUS_FOUND = 302;
55+
const STATUS_SEE_OTHER = 303;
56+
const STATUS_NOT_MODIFIED = 304;
57+
const STATUS_USE_PROXY = 305;
58+
const STATUS_RESERVED = 306;
59+
const STATUS_TEMPORARY_REDIRECT = 307;
60+
const STATUS_PERMANENT_REDIRECT = 308;
61+
//Client Error 4xx
62+
const STATUS_BAD_REQUEST = 400;
63+
const STATUS_UNAUTHORIZED = 401;
64+
const STATUS_PAYMENT_REQUIRED = 402;
65+
const STATUS_FORBIDDEN = 403;
66+
const STATUS_NOT_FOUND = 404;
67+
const STATUS_METHOD_NOT_ALLOWED = 405;
68+
const STATUS_NOT_ACCEPTABLE = 406;
69+
const STATUS_PROXY_AUTHENTICATION_REQUIRED = 407;
70+
const STATUS_REQUEST_TIMEOUT = 408;
71+
const STATUS_CONFLICT = 409;
72+
const STATUS_GONE = 410;
73+
const STATUS_LENGTH_REQUIRED = 411;
74+
const STATUS_PRECONDITION_FAILED = 412;
75+
const STATUS_PAYLOAD_TOO_LARGE = 413;
76+
const STATUS_URI_TOO_LONG = 414;
77+
const STATUS_UNSUPPORTED_MEDIA_TYPE = 415;
78+
const STATUS_RANGE_NOT_SATISFIABLE = 416;
79+
const STATUS_EXPECTATION_FAILED = 417;
80+
const STATUS_UNPROCESSABLE_ENTITY = 422;
81+
const STATUS_LOCKED = 423;
82+
const STATUS_FAILED_DEPENDENCY = 424;
83+
const STATUS_UPGRADE_REQUIRED = 426;
84+
const STATUS_PRECONDITION_REQUIRED = 428;
85+
const STATUS_TOO_MANY_REQUESTS = 429;
86+
const STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE = 431;
87+
const STATUS_UNAVAILABLE_FOR_LEGAL_REASONS = 451;
88+
//Server Error 5xx
89+
const STATUS_INTERNAL_SERVER_ERROR = 500;
90+
const STATUS_NOT_IMPLEMENTED = 501;
91+
const STATUS_BAD_GATEWAY = 502;
92+
const STATUS_SERVICE_UNAVAILABLE = 503;
93+
const STATUS_GATEWAY_TIMEOUT = 504;
94+
const STATUS_VERSION_NOT_SUPPORTED = 505;
95+
const STATUS_VARIANT_ALSO_NEGOTIATES = 506;
96+
const STATUS_INSUFFICIENT_STORAGE = 507;
97+
const STATUS_LOOP_DETECTED = 508;
98+
const STATUS_NOT_EXTENDED = 510;
99+
const STATUS_NETWORK_AUTHENTICATION_REQUIRED = 511;
100+
}

0 commit comments

Comments
 (0)