{"id":22446775,"url":"https://github.com/crypto-scythe/http","last_synced_at":"2026-02-12T07:03:12.602Z","repository":{"id":158928531,"uuid":"634322383","full_name":"crypto-scythe/http","owner":"crypto-scythe","description":"PHP convenience classes for HTTP header fields, media types and status codes","archived":false,"fork":false,"pushed_at":"2025-03-09T09:02:02.000Z","size":43,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T21:06:56.845Z","etag":null,"topics":["headers","headers-mime","http","http-headers","library","mime-types","php","php-library","php8","status-codes"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crypto-scythe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-29T18:46:16.000Z","updated_at":"2025-03-09T08:57:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"f137498f-848f-42f5-a301-ae91356ac059","html_url":"https://github.com/crypto-scythe/http","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crypto-scythe%2Fhttp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crypto-scythe%2Fhttp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crypto-scythe%2Fhttp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crypto-scythe%2Fhttp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crypto-scythe","download_url":"https://codeload.github.com/crypto-scythe/http/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248782269,"owners_count":21160717,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["headers","headers-mime","http","http-headers","library","mime-types","php","php-library","php8","status-codes"],"created_at":"2024-12-06T04:11:19.255Z","updated_at":"2026-02-12T07:03:07.558Z","avatar_url":"https://github.com/crypto-scythe.png","language":"PHP","readme":"# PHP convenience classes for HTTP header fields, status codes and media types\n\nClasses with constants for convenient usage. The data source is the JSON output from https://webconcepts.info\nwhich provides extensive information about the underlying concepts including links to specifications of all\nprovided header fields, status codes and media types.\n\n## Installation with Composer\n```shell\ncomposer require crypto_scythe/http\n```\n\n## Class contents\n\n### Example for `AuthenticationSchemes`\n\n```php\n/**\n * Authentication scheme Basic\n *\n * The Basic authentication scheme is based on the model that the client needs to authenticate itself with a\n * user-id and a password for each protection space (\"realm\"). The realm value is a free-form string that can\n * only be compared for equality with other realms on that server.\n *\n * @see https://webconcepts.info/specs/IETF/RFC/7617\n * @see https://datatracker.ietf.org/doc/html/rfc7617#section-2\n */\npublic const BASIC = 'Basic';\n```\n\n### Example for `CacheDirectives`\n\n```php\n/**\n * Cache directive max-age\n *\n * The \"max-age\" request directive indicates that the client is unwilling to accept a response whose age is\n * greater than the specified number of seconds. Unless the max-stale request directive is also present, the\n * client is not willing to accept a stale response. The \"max-age\" response directive indicates that the\n * response is to be considered stale after its age is greater than the specified number of seconds.\n *\n * @see https://webconcepts.info/specs/IETF/RFC/7234\n * @see https://datatracker.ietf.org/doc/html/rfc7234#section-5.2.1.1\n */\npublic const MAX_AGE = 'max-age';\n```\n\n### Example for `ContentCodings.php`\n\n```php\n/**\n * Content coding gzip\n *\n * The \"gzip\" coding is an LZ77 coding with a 32-bit Cyclic Redundancy Check (CRC) that is commonly produced by\n * the gzip file compression program. A recipient SHOULD consider \"x-gzip\" to be equivalent to \"gzip\".\n *\n * @see https://webconcepts.info/specs/IETF/RFC/7230\n * @see https://datatracker.ietf.org/doc/html/rfc7230#section-4.2.3\n */\npublic const GZIP = 'gzip';\n```\n\n### Example for `ForwardedParameters`\n\n```php\n/**\n * Forwarded parameter for\n *\n * The \"for\" parameter is used to disclose information about the client that initiated the request and\n * subsequent proxies in a chain of proxies.\n *\n * @see https://webconcepts.info/specs/IETF/RFC/7239\n * @see https://datatracker.ietf.org/doc/html/rfc7239#section-5.2\n */\npublic const FOR = 'for';\n```\n\n### Example for `HeaderFields.php`\n\n```php\n/**\n * Header field Content-Type\n *\n * The \"Content-Type\" header field indicates the media type of the associated representation: either the\n * representation enclosed in the message payload or the selected representation, as determined by the message\n * semantics. The indicated media type defines both the data format and how that data is intended to be\n * processed by a recipient, within the scope of the received message semantics, after any content codings\n * indicated by Content-Encoding are decoded.\n *\n * @see https://webconcepts.info/specs/IETF/RFC/7231\n * @see https://datatracker.ietf.org/doc/html/rfc7231#section-3.1.1.5\n */\npublic const CONTENT_TYPE = 'Content-Type';\n```\n\n### Example for `LinkRelations`\n\n```php\n/**\n * Link relation canonical\n *\n * The target (canonical) IRI MUST identify content that is either duplicative or a superset of the content at\n * the context (referring) IRI.\n *\n * @see https://webconcepts.info/specs/IETF/RFC/6596\n * @see https://datatracker.ietf.org/doc/html/rfc6596#section-3\n */\npublic const CANONICAL = 'canonical';\n```\n\n### Example for `MediaTypes`\n\n```php\n/**\n * Media type application/json\n *\n * JavaScript Object Notation (JSON) is a text format for the serialization of structured data. It is derived\n * from the object literals of JavaScript, as defined in the ECMAScript Programming Language Standard, Third\n * Edition.\n *\n * @see https://webconcepts.info/specs/IETF/I-D/ietf-jsonbis-rfc7159bis\n * @see https://datatracker.ietf.org/doc/html/draft-ietf-jsonbis-rfc7159bis#section-1\n * \n * JavaScript Object Notation (JSON) is a text format for the serialization of structured data. It is derived\n * from the object literals of JavaScript, as defined in the ECMAScript Programming Language Standard, Third\n * Edition. JSON can represent four primitive types (strings, numbers, booleans, and null) and two structured\n * types (objects and arrays).\n *\n * @see https://webconcepts.info/specs/IETF/RFC/8259\n * @see https://datatracker.ietf.org/doc/html/rfc8259#section-1\n */\npublic const APPLICATION_JSON = 'application/json';\n```\n\n### Example for `Preferences`\n\n```php\n/**\n * Preference wait\n *\n * The \"wait\" preference can be used to establish an upper bound on the length of time, in seconds, the client\n * expects it will take the server to process the request once it has been received.\n *\n * @see https://webconcepts.info/specs/IETF/RFC/7240\n * @see https://datatracker.ietf.org/doc/html/rfc7240#section-4.3\n */\npublic const WAIT = 'wait';\n```\n\n### Example for `RangeUnits`\n\n```php\n/**\n * Range unit bytes\n *\n * Since representation data is transferred in payloads as a sequence of octets, a byte range is a meaningful\n * substructure for any representation transferable over HTTP. The \"bytes\" range unit is defined for expressing\n * subranges of the data's octet sequence.\n *\n * @see https://webconcepts.info/specs/IETF/RFC/7233\n * @see https://datatracker.ietf.org/doc/html/rfc7233#section-2.1\n */\npublic const BYTES = 'bytes';\n```\n\n### Example for `RequestMethods`\n\n```php\n/**\n * Request method GET\n *\n * The GET method requests transfer of a current selected representation for the target resource. GET is the\n * primary mechanism of information retrieval and the focus of almost all performance optimizations. Hence, when\n * people speak of retrieving some identifiable information via HTTP, they are generally referring to making a\n * GET request.\n *\n * @see https://webconcepts.info/specs/IETF/RFC/7231\n * @see https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.1\n */\npublic const GET = 'GET';\n```\n\n### Example for `StatusCodes`\n\n```php\n/**\n * Status 200\n *\n * The 200 (OK) status code indicates that the request has succeeded. The payload sent in a 200 response depends\n * on the request method.\n *\n * @see https://webconcepts.info/specs/IETF/RFC/7231\n * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.3.1\n */\npublic const STATUS_200 = 200;\npublic const MESSAGE_200 = 'OK';\npublic const STATUS_OK = self::STATUS_200;\npublic const MESSAGE_OK = self::MESSAGE_200;\n```\n\n### Example for `TransferCodings`\n\n```php\n/**\n * Transfer coding chunked\n *\n * The chunked transfer coding wraps the payload body in order to transfer it as a series of chunks, each with\n * its own size indicator, followed by an OPTIONAL trailer containing header fields.  Chunked enables content\n * streams of unknown size to be transferred as a sequence of length-delimited buffers, which enables the sender\n * to retain connection persistence and the recipient to know when it has received the entire message.\n *\n * @see https://webconcepts.info/specs/IETF/RFC/7230\n * @see https://datatracker.ietf.org/doc/html/rfc7230#section-4.1\n */\npublic const CHUNKED = 'chunked';\n```\n\n### Example Usage\n\n```php\nuse CryptoScythe\\Http\\HeaderFields;\nuse CryptoScythe\\Http\\MediaTypes;\nuse CryptoScythe\\Http\\StatusCodes;\n\nheader(\n    sprintf(\n        '%s: %s',\n        HeaderFields::CONTENT_TYPE,\n        MediaTypes::APPLICATION_JSON,\n    ),\n    true,\n    StatusCodes::STATUS_200,\n);\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrypto-scythe%2Fhttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrypto-scythe%2Fhttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrypto-scythe%2Fhttp/lists"}