PHPackages                             crypto\_scythe/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. crypto\_scythe/http

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

crypto\_scythe/http
===================

PHP convenience classes for HTTP header fields, media types and status codes

1.3.0(1y ago)17MITPHPPHP ^8.1

Since Apr 29Pushed 1y ago1 watchersCompare

[ Source](https://github.com/crypto-scythe/http)[ Packagist](https://packagist.org/packages/crypto_scythe/http)[ RSS](/packages/crypto-scythe-http/feed)WikiDiscussions main Synced 1mo ago

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

PHP convenience classes for HTTP header fields, status codes and media types
============================================================================

[](#php-convenience-classes-for-http-header-fields-status-codes-and-media-types)

Classes with constants for convenient usage. The data source is the JSON output from which provides extensive information about the underlying concepts including links to specifications of all provided header fields, status codes and media types.

Installation with Composer
--------------------------

[](#installation-with-composer)

```
composer require crypto_scythe/http
```

Class contents
--------------

[](#class-contents)

### Example for `AuthenticationSchemes`

[](#example-for-authenticationschemes)

```
/**
 * Authentication scheme Basic
 *
 * The Basic authentication scheme is based on the model that the client needs to authenticate itself with a
 * user-id and a password for each protection space ("realm"). The realm value is a free-form string that can
 * only be compared for equality with other realms on that server.
 *
 * @see https://webconcepts.info/specs/IETF/RFC/7617
 * @see https://datatracker.ietf.org/doc/html/rfc7617#section-2
 */
public const BASIC = 'Basic';
```

### Example for `CacheDirectives`

[](#example-for-cachedirectives)

```
/**
 * Cache directive max-age
 *
 * The "max-age" request directive indicates that the client is unwilling to accept a response whose age is
 * greater than the specified number of seconds. Unless the max-stale request directive is also present, the
 * client is not willing to accept a stale response. The "max-age" response directive indicates that the
 * response is to be considered stale after its age is greater than the specified number of seconds.
 *
 * @see https://webconcepts.info/specs/IETF/RFC/7234
 * @see https://datatracker.ietf.org/doc/html/rfc7234#section-5.2.1.1
 */
public const MAX_AGE = 'max-age';
```

### Example for `ContentCodings.php`

[](#example-for-contentcodingsphp)

```
/**
 * Content coding gzip
 *
 * The "gzip" coding is an LZ77 coding with a 32-bit Cyclic Redundancy Check (CRC) that is commonly produced by
 * the gzip file compression program. A recipient SHOULD consider "x-gzip" to be equivalent to "gzip".
 *
 * @see https://webconcepts.info/specs/IETF/RFC/7230
 * @see https://datatracker.ietf.org/doc/html/rfc7230#section-4.2.3
 */
public const GZIP = 'gzip';
```

### Example for `ForwardedParameters`

[](#example-for-forwardedparameters)

```
/**
 * Forwarded parameter for
 *
 * The "for" parameter is used to disclose information about the client that initiated the request and
 * subsequent proxies in a chain of proxies.
 *
 * @see https://webconcepts.info/specs/IETF/RFC/7239
 * @see https://datatracker.ietf.org/doc/html/rfc7239#section-5.2
 */
public const FOR = 'for';
```

### Example for `HeaderFields.php`

[](#example-for-headerfieldsphp)

```
/**
 * Header field Content-Type
 *
 * The "Content-Type" header field indicates the media type of the associated representation: either the
 * representation enclosed in the message payload or the selected representation, as determined by the message
 * semantics. The indicated media type defines both the data format and how that data is intended to be
 * processed by a recipient, within the scope of the received message semantics, after any content codings
 * indicated by Content-Encoding are decoded.
 *
 * @see https://webconcepts.info/specs/IETF/RFC/7231
 * @see https://datatracker.ietf.org/doc/html/rfc7231#section-3.1.1.5
 */
public const CONTENT_TYPE = 'Content-Type';
```

### Example for `LinkRelations`

[](#example-for-linkrelations)

```
/**
 * Link relation canonical
 *
 * The target (canonical) IRI MUST identify content that is either duplicative or a superset of the content at
 * the context (referring) IRI.
 *
 * @see https://webconcepts.info/specs/IETF/RFC/6596
 * @see https://datatracker.ietf.org/doc/html/rfc6596#section-3
 */
public const CANONICAL = 'canonical';
```

### Example for `MediaTypes`

[](#example-for-mediatypes)

```
/**
 * Media type application/json
 *
 * JavaScript Object Notation (JSON) is a text format for the serialization of structured data. It is derived
 * from the object literals of JavaScript, as defined in the ECMAScript Programming Language Standard, Third
 * Edition.
 *
 * @see https://webconcepts.info/specs/IETF/I-D/ietf-jsonbis-rfc7159bis
 * @see https://datatracker.ietf.org/doc/html/draft-ietf-jsonbis-rfc7159bis#section-1
 *
 * JavaScript Object Notation (JSON) is a text format for the serialization of structured data. It is derived
 * from the object literals of JavaScript, as defined in the ECMAScript Programming Language Standard, Third
 * Edition. JSON can represent four primitive types (strings, numbers, booleans, and null) and two structured
 * types (objects and arrays).
 *
 * @see https://webconcepts.info/specs/IETF/RFC/8259
 * @see https://datatracker.ietf.org/doc/html/rfc8259#section-1
 */
public const APPLICATION_JSON = 'application/json';
```

### Example for `Preferences`

[](#example-for-preferences)

```
/**
 * Preference wait
 *
 * The "wait" preference can be used to establish an upper bound on the length of time, in seconds, the client
 * expects it will take the server to process the request once it has been received.
 *
 * @see https://webconcepts.info/specs/IETF/RFC/7240
 * @see https://datatracker.ietf.org/doc/html/rfc7240#section-4.3
 */
public const WAIT = 'wait';
```

### Example for `RangeUnits`

[](#example-for-rangeunits)

```
/**
 * Range unit bytes
 *
 * Since representation data is transferred in payloads as a sequence of octets, a byte range is a meaningful
 * substructure for any representation transferable over HTTP. The "bytes" range unit is defined for expressing
 * subranges of the data's octet sequence.
 *
 * @see https://webconcepts.info/specs/IETF/RFC/7233
 * @see https://datatracker.ietf.org/doc/html/rfc7233#section-2.1
 */
public const BYTES = 'bytes';
```

### Example for `RequestMethods`

[](#example-for-requestmethods)

```
/**
 * Request method GET
 *
 * The GET method requests transfer of a current selected representation for the target resource. GET is the
 * primary mechanism of information retrieval and the focus of almost all performance optimizations. Hence, when
 * people speak of retrieving some identifiable information via HTTP, they are generally referring to making a
 * GET request.
 *
 * @see https://webconcepts.info/specs/IETF/RFC/7231
 * @see https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.1
 */
public const GET = 'GET';
```

### Example for `StatusCodes`

[](#example-for-statuscodes)

```
/**
 * Status 200
 *
 * The 200 (OK) status code indicates that the request has succeeded. The payload sent in a 200 response depends
 * on the request method.
 *
 * @see https://webconcepts.info/specs/IETF/RFC/7231
 * @see https://datatracker.ietf.org/doc/html/rfc7231#section-6.3.1
 */
public const STATUS_200 = 200;
public const MESSAGE_200 = 'OK';
public const STATUS_OK = self::STATUS_200;
public const MESSAGE_OK = self::MESSAGE_200;
```

### Example for `TransferCodings`

[](#example-for-transfercodings)

```
/**
 * Transfer coding chunked
 *
 * The chunked transfer coding wraps the payload body in order to transfer it as a series of chunks, each with
 * its own size indicator, followed by an OPTIONAL trailer containing header fields.  Chunked enables content
 * streams of unknown size to be transferred as a sequence of length-delimited buffers, which enables the sender
 * to retain connection persistence and the recipient to know when it has received the entire message.
 *
 * @see https://webconcepts.info/specs/IETF/RFC/7230
 * @see https://datatracker.ietf.org/doc/html/rfc7230#section-4.1
 */
public const CHUNKED = 'chunked';
```

### Example Usage

[](#example-usage)

```
use CryptoScythe\Http\HeaderFields;
use CryptoScythe\Http\MediaTypes;
use CryptoScythe\Http\StatusCodes;

header(
    sprintf(
        '%s: %s',
        HeaderFields::CONTENT_TYPE,
        MediaTypes::APPLICATION_JSON,
    ),
    true,
    StatusCodes::STATUS_200,
);
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance45

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~226 days

Total

4

Last Release

427d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7a93df05505552ed0d6d26f8abe11f0ce95ed47992b9c0766ff5b76407a40b5f?d=identicon)[crypto\_scythe](/maintainers/crypto_scythe)

---

Top Contributors

[![crypto-scythe](https://avatars.githubusercontent.com/u/908195?v=4)](https://github.com/crypto-scythe "crypto-scythe (5 commits)")

---

Tags

headersheaders-mimehttphttp-headerslibrarymime-typesphpphp-libraryphp8status-codeshttptypecodeheadermediaheadersstatus

### Embed Badge

![Health badge](/badges/crypto-scythe-http/health.svg)

```
[![Health](https://phpackages.com/badges/crypto-scythe-http/health.svg)](https://phpackages.com/packages/crypto-scythe-http)
```

###  Alternatives

[paragonie/csp-builder

Easily add and update Content-Security-Policy headers for your project

5412.8M18](/packages/paragonie-csp-builder)[laravel-lang/http-statuses

Translation of HTTP statuses

283.2M7](/packages/laravel-lang-http-statuses)[delight-im/http

Hypertext Transfer Protocol (HTTP) utilities for PHP

191.3M4](/packages/delight-im-http)[ph-7/just-http-status-codes

Just all HTTP status codes

1447.7k4](/packages/ph-7-just-http-status-codes)[ptlis/conneg

Tools for performing content negotiation.

364.9k1](/packages/ptlis-conneg)[bakame/http-structured-fields

A PHP library that parses, validates and serializes HTTP structured fields according to RFC9561 and RFC8941

442.6k4](/packages/bakame-http-structured-fields)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
