# php-fig/http-message

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/php-fig-http-message).**

7,049 stars · 186 forks · PHP · MIT

## Links

- GitHub: https://github.com/php-fig/http-message
- Homepage: https://www.php-fig.org/psr/psr-7/
- awesome-repositories: https://awesome-repositories.com/repository/php-fig-http-message.md

## Topics

`http` `php` `php-fig` `psr`

## Description

PSR-7 HTTP Message Interfaces is a set of standardized PHP interfaces for representing HTTP request and response messages, URIs, streams, and uploaded files as immutable value objects. These interfaces define a common contract that enables interoperability between PHP frameworks and libraries when handling HTTP messages, ensuring that any implementation can be used interchangeably.

The interfaces model HTTP messages as immutable value objects where any modification produces a new instance, guaranteeing message integrity throughout the request lifecycle. They provide case-insensitive header access and retrieval, support for multi-valued headers, and stream-based body handling that enables efficient processing of large payloads without loading them entirely into memory. For server-side requests, the interfaces abstract PHP superglobals into structured objects with attributes for application-specific routing, and normalize uploaded file trees into consistent nested structures with safe file movement and stream access methods.

URI handling is provided through immutable value objects that parse RFC 3986 URIs once and expose individual component accessors for scheme, authority, path, query, and fragment. The interfaces also include validation mechanisms that reject malformed header names and values to prevent injection attacks and parsing errors. The package consists solely of interfaces and does not include any implementations, serving as a foundational contract for the PHP ecosystem.

## Tags

### Software Engineering & Architecture

- [Immutable HTTP Message Models](https://awesome-repositories.com/f/software-engineering-architecture/object-mapping-apis/http-message-mapping/immutable-http-message-models.md) — Models HTTP messages as immutable value objects, the foundational concept of the PSR-7 standard. ([source](https://www.php-fig.org/psr/psr-7/meta))
- [Immutable HTTP Message](https://awesome-repositories.com/f/software-engineering-architecture/object-schema-definitions/value-objects/immutable-http-message.md) — Models HTTP messages as immutable value objects, the core architectural pattern of this package.
- [HTTP Message Mapping](https://awesome-repositories.com/f/software-engineering-architecture/object-mapping-apis/http-message-mapping.md) — Models HTTP messages as immutable value objects, the foundational concept of the PSR-7 standard. ([source](https://www.php-fig.org/psr/psr-7/meta/))
- [Unified Message Element Accessors](https://awesome-repositories.com/f/software-engineering-architecture/object-mapping-apis/http-message-mapping/http-message-diff-engines/unified-message-element-accessors.md) — Provides unified access to protocol version, headers, and body as a core part of the PSR-7 message interface. ([source](https://www.php-fig.org/psr/psr-7/meta))
- [Standardized HTTP Message Interfaces](https://awesome-repositories.com/f/software-engineering-architecture/object-mapping-apis/http-message-mapping/standardized-http-message-interfaces.md) — Provides the standardized interface for HTTP request and response messages, the core of the PSR-7 standard. ([source](https://www.php-fig.org/psr/psr-7/))
- [HTTP Header Accessors](https://awesome-repositories.com/f/software-engineering-architecture/string-matching-algorithms/string-comparisons/case-insensitive-comparators/http-header-accessors.md) — Provides case-insensitive header access and retrieval as a core part of the PSR-7 HTTP message interface. ([source](https://www.php-fig.org/psr/psr-7/))

### Web Development

- [PHP Interface Standards](https://awesome-repositories.com/f/web-development/web-standards/standards-compliant-implementations/php-interface-standards.md) — Defines the PSR-7 standard interfaces for HTTP messages, the core contract for PHP interoperability.
- [PHP Superglobal Request Abstractions](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling/http-request-handling/php-superglobal-request-abstractions.md) — Abstracts PHP superglobals into structured request objects as a core part of the PSR-7 server request interface. ([source](https://www.php-fig.org/psr/psr-7/))
- [Standardized HTTP Request Interfaces](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling/http-utilities/http-header-manipulators/http-request-header-inspectors/standardized-http-request-interfaces.md) — Defines the standard interface for HTTP request messages as a core part of the PSR-7 standard. ([source](https://cdn.jsdelivr.net/gh/php-fig/http-message@master/README.md))
- [Standardized HTTP Response Interfaces](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling/http-utilities/http-response-builders/standardized-http-response-interfaces.md) — Defines the standard interface for HTTP response messages as a core part of the PSR-7 standard. ([source](https://cdn.jsdelivr.net/gh/php-fig/http-message@master/README.md))
- [Server-Side Request Parameter Accessors](https://awesome-repositories.com/f/web-development/http-request-parameter-management/server-side-request-parameter-accessors.md) — Provides access to server-side request parameters as a core part of the PSR-7 server request interface. ([source](https://www.php-fig.org/psr/psr-7/meta))
- [Body Streaming](https://awesome-repositories.com/f/web-development/request-body-handling/body-streaming.md) — Models message bodies as streamable objects for efficient processing of large payloads.
- [Stream Interfaces](https://awesome-repositories.com/f/web-development/request-body-handling/body-streaming/stream-interfaces.md) — Provides the PSR-7 StreamInterface for efficient body handling without full memory loading.
- [PHP Superglobal Abstractions](https://awesome-repositories.com/f/web-development/web-server-frameworks/server-interface-abstractions/php-superglobal-abstractions.md) — Abstracts PHP superglobals into structured request objects as a core part of the PSR-7 server request interface. ([source](http://www.php-fig.org/psr/psr-7/))
- [Request-Target Form Handlers](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling/http-request-handling/request-target-form-handlers.md) — Supports all four forms of the HTTP request-target as a feature of the PSR-7 request interface. ([source](https://www.php-fig.org/psr/psr-7/meta))
- [Request Target Representations](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling/http-request-handling/request-target-representations.md) — Defines the four standard forms of HTTP request targets for message representation. ([source](http://www.php-fig.org/psr/psr-7/))

### Part of an Awesome List

- [Uploaded File Interfaces](https://awesome-repositories.com/f/awesome-lists/devtools/file-upload/uploaded-file-interfaces.md) — Defines the PSR-7 UploadedFileInterface for safe file handling from PHP superglobals.
- [Uploaded File Tree Normalizations](https://awesome-repositories.com/f/awesome-lists/devtools/file-upload/uploaded-file-tree-normalizations.md) — Normalizes PHP uploaded file data into a predictable tree of file objects.

### Data & Databases

- [Streamed Message Body Interfaces](https://awesome-repositories.com/f/data-databases/data-structure-definitions/message-body-notations/streamed-message-body-interfaces.md) — Defines a stream interface for HTTP message bodies as a core part of the PSR-7 standard. ([source](https://cdn.jsdelivr.net/gh/php-fig/http-message@master/README.md))

### Networking & Communication

- [Uploaded File Tree Normalizations](https://awesome-repositories.com/f/networking-communication/http-file-uploads/uploaded-file-tree-normalizations.md) — Provides a standard interface for normalizing PHP uploaded file data into structured objects. ([source](https://www.php-fig.org/psr/psr-7/))
- [Parameter Bag Abstractions](https://awesome-repositories.com/f/networking-communication/http-request-abstractions/parameter-bag-abstractions.md) — Wraps PHP superglobals into structured request objects with typed parameter bag access.
- [Multi-Value Headers](https://awesome-repositories.com/f/networking-communication/multi-value-headers.md) — Supports returning header values as comma-separated strings or arrays for multi-valued headers.
- [Casing Normalization](https://awesome-repositories.com/f/networking-communication/proxy-headers/casing-normalization.md) — Normalizes HTTP header casing for case-insensitive retrieval while preserving original casing.
- [Case-Insensitive Header Normalizers](https://awesome-repositories.com/f/networking-communication/proxy-headers/header-normalization/case-insensitive-header-normalizers.md) — Provides case-insensitive header normalization as a core part of the PSR-7 HTTP message interface. ([source](http://www.php-fig.org/psr/psr-7/))
- [URI Construction and Parsing](https://awesome-repositories.com/f/networking-communication/uri-handlers/uri-construction-and-parsing.md) — Parses and composes HTTP and HTTPS URIs according to RFC 3986 with component accessors. ([source](https://www.php-fig.org/psr/psr-7/))
- [URI Segment Readers and Modifiers](https://awesome-repositories.com/f/networking-communication/uri-handlers/uri-construction-and-parsing/uri-segment-readers-and-modifiers.md) — Provides accessors for individual URI segments like scheme, authority, path, query, and fragment. ([source](https://www.php-fig.org/psr/psr-7/meta/))
- [URI Value Object Interfaces](https://awesome-repositories.com/f/networking-communication/uri-handlers/uri-construction-and-parsing/uri-value-object-interfaces.md) — Defines the PSR-7 UriInterface for immutable URI value objects with component accessors.
- [URI Value Object Parsings](https://awesome-repositories.com/f/networking-communication/uri-handlers/uri-construction-and-parsing/uri-value-object-parsings.md) — Parses URIs once into value objects for efficient component access without repeated parsing.
- [URI Value Object Representations](https://awesome-repositories.com/f/networking-communication/uri-handlers/uri-construction-and-parsing/uri-value-object-representations.md) — Represents URIs as immutable value objects parsed once for efficient segment access. ([source](https://www.php-fig.org/psr/psr-7/meta))
- [Host Header Rewriting](https://awesome-repositories.com/f/networking-communication/http-clients/host-header-rewriting.md) — Synchronizes the Host header with the URI's host component as a feature of the PSR-7 request interface. ([source](https://www.php-fig.org/psr/psr-7/))
- [URI-Based Host Header Synchronizers](https://awesome-repositories.com/f/networking-communication/http-clients/host-header-rewriting/uri-based-host-header-synchronizers.md) — Synchronizes the Host header with the URI's host component as a feature of the PSR-7 request interface. ([source](http://www.php-fig.org/psr/psr-7/))
- [Safe Uploaded File Movers](https://awesome-repositories.com/f/networking-communication/http-file-uploads/safe-uploaded-file-movers.md) — Provides safe file movement for uploaded files as a feature of the PSR-7 uploaded file interface. ([source](http://www.php-fig.org/psr/psr-7/))
- [Uploaded File Tree Normalizers](https://awesome-repositories.com/f/networking-communication/http-file-uploads/uploaded-file-tree-normalizers.md) — Normalizes the PHP $_FILES array into a consistent tree structure as a feature of the PSR-7 uploaded file interface. ([source](http://www.php-fig.org/psr/psr-7/))
- [HTTP Header Validations](https://awesome-repositories.com/f/networking-communication/http-header-validations.md) — Enforces standardized naming and value constraints on HTTP headers to prevent injection attacks. ([source](https://www.php-fig.org/psr/psr-7/meta/))
- [Header Name and Value Validations](https://awesome-repositories.com/f/networking-communication/http-header-validations/header-name-and-value-validations.md) — Rejects malformed header names and values to prevent CRLF injection and parsing attacks. ([source](https://www.php-fig.org/psr/psr-7/meta))
- [Request Target Overrides](https://awesome-repositories.com/f/networking-communication/http-request-customization/request-target-overrides.md) — Allows overriding the default request target to support specialized HTTP request forms. ([source](https://www.php-fig.org/psr/psr-7/))
