PSR-7 HTTP Message Interfaces

The PHP-FIG PSR-7 standard interfaces for HTTP requests, responses, streams, URIs, and uploaded files.

Library
Composer
v2.0
7,034stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
43/100Fair
Development Activity0
Maintenance20
Community52
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
72/100Good
Architecture82
Code Quality70
Innovation60
Learning Curve75

psr/http-message is the official PHP-FIG package defining PSR-7: a shared set of interfaces (RequestInterface, ResponseInterface, ServerRequestInterface, StreamInterface, UriInterface, UploadedFileInterface) for representing HTTP messages in PHP. It contains no implementation of its own — only the contracts — so that frameworks, HTTP clients, and middleware can be written against a common HTTP message abstraction instead of each defining incompatible request/response classes.

Because nearly every modern PHP framework, HTTP client (Guzzle, Symfony HttpClient), and middleware system (PSR-15) either implements or consumes these interfaces, psr/http-message functions as foundational interoperability plumbing for the PHP ecosystem: with over 18 million monthly installs, it is one of the most widely depended-upon packages in Composer’s registry, even though most developers never interact with it directly — they interact with concrete implementations (e.g. guzzlehttp/psr7, nyholm/psr7, or a framework’s own request/response objects) that satisfy these interfaces.

What You Get

  • MessageInterface and its RequestInterface/ResponseInterface/ServerRequestInterface extensions describing an immutable HTTP message
  • StreamInterface for representing an HTTP message body as a PSR-7-compatible stream abstraction
  • UriInterface for representing and manipulating a URI per RFC 3986
  • UploadedFileInterface for representing a file uploaded via an HTTP request
  • Documentation (docs/PSR7-Interfaces.md, docs/PSR7-Usage.md) describing method contracts and correct usage patterns

Common Use Cases

  • Type-hinting middleware or controller methods against RequestInterface/ResponseInterface instead of a framework-specific request class
  • Building a PSR-7-compatible HTTP client or server library that any PSR-7 consumer can use interchangeably
  • Implementing PSR-15 middleware, which is built directly on top of these PSR-7 message interfaces
  • Writing framework-agnostic PHP libraries that need to accept or return HTTP messages without depending on a specific framework

Under The Hood

Architecture — The package is a pure interface definition set under src/: MessageInterface is the base contract extended by RequestInterface (adds method/target/URI) and further by ServerRequestInterface (adds server params, query params, parsed body, uploaded files, attributes), while ResponseInterface extends MessageInterface with a status code and reason phrase; StreamInterface, UriInterface, and UploadedFileInterface are separate, composed-in contracts rather than inheritance targets. There is no src/ implementation code beyond these interface declarations — by design, this repository defines the contract only. Tech Stack — Plain PHP interfaces requiring PHP 7.2+/8.0, with zero dependencies (composer.json requires only php); autoloaded via PSR-4 under the Psr\Http\Message\ namespace. Code Quality — There is no test suite in this repository because there is no executable code to test — correctness is instead enforced socially, through the PHP-FIG standards process and by the extensive third-party test suites of libraries (Guzzle, nyholm/psr7, Laminas) that implement these interfaces. API Design — Every mutating method (e.g. withHeader(), withBody(), withUri()) explicitly returns a new instance rather than mutating in place, documented immutability that gives implementers an unambiguous, consistent contract; the interfaces are intentionally minimal (no convenience methods), keeping them easy to implement fully but requiring implementers to add ergonomic helpers themselves.

Used by 6 apps in this directory

PHP
66%
AGPL 3.0

EspoCRM

Marketing · Ecommerce · CRM

3,259

Open-source CRM platform with metadata-driven customization, field-level permissions, and a full REST API — deploy on your own infrastructure.

View details
97
Repo Health
72
Technical
64
Dependency
Built with
PHP66%
JavaScript24%
Updated yesterday
TypeScript
75%
Apache 2.0

Fern

Developer Tools

3,761

Fern turns a single OpenAPI, AsyncAPI, or Protobuf definition into type-safe SDKs for nine languages and a hosted API documentation site, all from one CLI and one source of truth.

View details
90
Repo Health
86
Technical
67
Dependency
Built with
TypeScript75%
Updated today
TypeScript
72%
AGPL 3.0

Firecrawl

AI Development · Developer Tools

169,311

Turn any website into clean, LLM-ready data with a single API call — no proxy headaches, no scraping complexity.

View details
89
Repo Health
83
Technical
66
Dependency
Built with
TypeScript72%
Python14%
Updated today
PHP
91%
AGPL 3.0

FreeScout

Customer Support

4,484

Run your own help desk and shared inbox — a fully self-hosted, open-source alternative to Zendesk and Help Scout with no per-agent fees.

View details
93
Repo Health
55
Technical
63
Dependency
Built with
PHP91%
Updated yesterday
PHP
85%
Other

Invoice Ninja

Invoicing Finance · Project Management

10,008

Self-hostable invoicing, time-tracking, and multi-gateway payment platform for freelancers and small businesses, with built-in e-invoicing compliance for EU and global standards.

View details
97
Repo Health
83
Technical
62
Dependency
Built with
PHP85%
XSLT10%
Updated 2 days ago
PHP
84%
MIT

wallabag

Bookmarks Archiving

12,917

Self-hosted read-it-later app that saves clean, ad-free articles from any webpage for distraction-free reading across all your devices.

View details
92
Repo Health
81
Technical
59
Dependency
Built with
PHP84%
Twig13%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search