Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/koriym/koriym.httpconstants
Constants for the HTTP protocol
https://github.com/koriym/koriym.httpconstants
http-code
Last synced: about 2 months ago
JSON representation
Constants for the HTTP protocol
- Host: GitHub
- URL: https://github.com/koriym/koriym.httpconstants
- Owner: koriym
- License: mit
- Created: 2015-08-30T07:59:58.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-10-12T11:02:53.000Z (about 3 years ago)
- Last Synced: 2024-10-11T08:14:17.501Z (2 months ago)
- Topics: http-code
- Language: PHP
- Homepage:
- Size: 19.5 KB
- Stars: 8
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Koriym.HttpConstants
Contains the values of status codes, request method, and headers for the Hypertext Transfer Protocol (HTTP).
Constants only.## Example
```php
use Koriym\HttpConstants\HttpStatusCode;
use Koriym\HttpConstants\RequestHeader;
use Koriym\HttpConstants\ResponseHeader;
use Koriym\HttpConstants\MediaType;
use Koriym\HttpConstants\Method;http_response_code(StatusCode::BAD_REQUEST);
header(ResponseHeader::CONTENT_TYPE . ': ' . MediaType::APPLICATION_JSON_API);
// Content-Type: application/vnd.api+json
header(ResponseHeader::CACHE_CONTROL . ': max-age=3600');
// Cache-Control: max-age=3600
```### Install
$ composer require koriym/http-constants
See also [PSR Http Message Util](https://github.com/php-fig/http-message-util).