PHPackages                             php-pico/http-message - 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. php-pico/http-message

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

php-pico/http-message
=====================

PSR-7 compliant HTTP message package.

0.1.0(today)00MITPHPPHP ^8.5

Since Jun 22Pushed todayCompare

[ Source](https://github.com/php-pico/http-message)[ Packagist](https://packagist.org/packages/php-pico/http-message)[ RSS](/packages/php-pico-http-message/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (3)Versions (2)Used By (0)

php-pico/http-message
=====================

[](#php-picohttp-message)

A lean, dependency-free [PSR-7](https://www.php-fig.org/psr/psr-7/) implementation: immutable HTTP message objects for PHP 8.5+.

It provides the value objects defined by `psr/http-message` v2 — requests, responses, URIs, streams, and uploaded files. Every object is immutable: each `with*()` method returns a new instance and leaves the original untouched.

Installation
------------

[](#installation)

```
composer require php-pico/http-message
```

Usage
-----

[](#usage)

### Requests and responses

[](#requests-and-responses)

```
use PhpPico\Http\Message\{Request, Response, Uri};

$request = new Request('GET', new Uri('https://example.com/users?page=2'));
$request->getMethod();          // 'GET'
$request->getRequestTarget();   // '/users?page=2'
$request->getHeaderLine('Host'); // 'example.com'

$response = new Response()
    ->withStatus(404)
    ->withHeader('Content-Type', 'application/json');

$response->getStatusCode();     // 404
$response->getReasonPhrase();   // 'Not Found'
```

### Immutability

[](#immutability)

```
$a = new Response();
$b = $a->withStatus(500);

$a->getStatusCode(); // 200 — unchanged
$b->getStatusCode(); // 500
```

### URIs

[](#uris)

```
use PhpPico\Http\Message\Uri;

$uri = new Uri('https://user:pass@example.com:443/path?q=1#frag');

$uri->getScheme();    // 'https'
$uri->getHost();      // 'example.com'
$uri->getPort();      // null — 443 is the standard port for https
(string) $uri;        // 'https://user:pass@example.com/path?q=1#frag'
```

### Streams

[](#streams)

```
use PhpPico\Http\Message\Stream;

$body = Stream::create('Hello, world');
$response = new Response()->withBody($body);

(string) $response->getBody(); // 'Hello, world'
```

### Server requests and uploads

[](#server-requests-and-uploads)

```
use PhpPico\Http\Message\{ServerRequest, Uri};

$request = new ServerRequest('POST', new Uri('https://example.com/submit'), $_SERVER)
    ->withQueryParams($_GET)
    ->withParsedBody($_POST)
    ->withCookieParams($_COOKIE);

$request->getAttribute('user'); // null until set via withAttribute()
```

Validation
----------

[](#validation)

Input is validated strictly per the spec: header injection (CR/LF) is rejected, header names and HTTP methods must be valid tokens, ports must be in range, and status codes must be 100–599. Invalid input throws `InvalidArgumentException`; misuse of streams or uploaded files throws `RuntimeException`.

Creating messages from factories
--------------------------------

[](#creating-messages-from-factories)

This package contains the message objects only. To construct them through the [PSR-17](https://www.php-fig.org/psr/psr-17/) factory interfaces, use the companion factory package (published separately).

License
-------

[](#license)

MIT

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

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

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/33836112?v=4)[Kevin From](/maintainers/kevinfrom)[@kevinfrom](https://github.com/kevinfrom)

---

Top Contributors

[![kevinfrom](https://avatars.githubusercontent.com/u/33836112?v=4)](https://github.com/kevinfrom "kevinfrom (10 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/php-pico-http-message/health.svg)

```
[![Health](https://phpackages.com/badges/php-pico-http-message/health.svg)](https://phpackages.com/packages/php-pico-http-message)
```

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

7.9k1.1B3.7k](/packages/guzzlehttp-psr7)[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k532.1M2.5k](/packages/aws-aws-sdk-php)[symfony/psr-http-message-bridge

PSR HTTP message bridge

1.3k312.3M929](/packages/symfony-psr-http-message-bridge)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k496.1k33](/packages/neuron-core-neuron-ai)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35729.6k2](/packages/telnyx-telnyx-php)[laudis/neo4j-php-client

Neo4j-PHP-Client is the most advanced PHP Client for Neo4j

185671.3k41](/packages/laudis-neo4j-php-client)

PHPackages © 2026

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