koriym / http-constants
Constants for the HTTP protocol
Installs: 527 464
Dependents: 13
Suggesters: 0
Security: 0
Stars: 8
Watchers: 5
Forks: 1
Open Issues: 0
Requires
- php: >=7.1.0
This package is auto-updated.
Last update: 2024-12-12 17:36:36 UTC
README
Contains the values of status codes, request method, and headers for the Hypertext Transfer Protocol (HTTP). Constants only.
Example
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.