whatisgithub

What is http-message?

php-fig/http-message — explained in plain English

Analysis updated 2026-06-22

7,051PHPAudience · developerComplexity · 2/5Setup · easy

In one sentence

A PHP package that defines the PSR-7 standard interfaces for HTTP messages, allowing different PHP frameworks and libraries to share a common contract for requests, responses, and related types.

Mindmap

mindmap
  root((repo))
    What it does
      PSR-7 interfaces
      HTTP message contracts
    Standards
      RFC 7230 HTTP format
      RFC 7231 semantics
    Interfaces
      Request Response
      Headers URLs bodies
    Use Cases
      Framework interop
      Swap HTTP libraries
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Write PHP middleware or application code that works with any PSR-7-compatible HTTP library without being locked to one framework.

USE CASE 2

Swap HTTP client or server libraries in a project without rewriting application logic.

USE CASE 3

Build a reusable library that any PSR-7 framework can consume by coding to these shared interfaces.

What is it built with?

PHP

How does it compare?

php-fig/http-messagesebastianbergmann/comparatormongodb/laravel-mongodb
Stars7,0517,0527,079
LanguagePHPPHPPHP
Setup difficultyeasyeasymoderate
Complexity2/52/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Contains only interfaces, you need a separate PSR-7 implementation library to run actual HTTP code.

No license information is mentioned in the explanation.

So what is it?

php-fig/http-message is a PHP package that provides a set of shared interface definitions for HTTP messages. In PHP, an interface defines what methods an object must have without providing the actual code for those methods. This package defines the contracts for representing HTTP requests, responses, and related pieces like headers, URLs, and message bodies. The package is part of PHP-FIG, which stands for PHP Framework Interoperability Group. This organization creates standards that allow different PHP frameworks and libraries to work together. The standard this package implements is called PSR-7, which specifies how HTTP messages should be represented in PHP code. PSR-7 is based on two internet standards: RFC 7230, which defines the HTTP/1.1 message format, and RFC 7231, which covers the semantics and content of those messages. It is important to note that this package contains only interfaces, not a working implementation. Other libraries and frameworks provide the actual code that fulfills these interfaces. By coding to PSR-7 interfaces instead of a specific framework's classes, developers can write code that works with any library that implements the standard, making it easier to swap components in and out. The README points to two documents: a list of all the methods defined by the PSR-7 interfaces, and a usage guide explaining how to work with those interfaces in practice. Both are linked within the repository itself.

Copy-paste prompts

Prompt 1
Show me how to implement a PSR-7 compatible HTTP request object in PHP using php-fig/http-message interfaces.
Prompt 2
Using PSR-7 interfaces from php-fig/http-message, write a PHP middleware function that adds a custom header to every HTTP response.
Prompt 3
How do I use php-fig/http-message to write a PHP HTTP client wrapper that works with any PSR-7 framework?
Prompt 4
Explain the PSR-7 RequestInterface and ResponseInterface from php-fig/http-message and show a basic usage example.

Frequently asked questions

What is http-message?

A PHP package that defines the PSR-7 standard interfaces for HTTP messages, allowing different PHP frameworks and libraries to share a common contract for requests, responses, and related types.

What language is http-message written in?

Mainly PHP. The stack also includes PHP.

What license does http-message use?

No license information is mentioned in the explanation.

How hard is http-message to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is http-message for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.