PHPackages                             modufolio/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. modufolio/http

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

modufolio/http
==============

PSR-7 HTTP message implementation with additional utilities

0142↓33.3%PHPCI passing

Since Feb 25Pushed 2mo agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Modufolio HTTP
==============

[](#modufolio-http)

[![License: MIT](https://camo.githubusercontent.com/c2bffd81d308ced1cc3b0d66fb0ed453ab478a5e17c988b780f9de986a390ee2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://opensource.org/licenses/MIT) [![codecov](https://camo.githubusercontent.com/6edaeec78835792f5b82890253ecfe8989e24ee0f1d11325d4f97af806c8f469/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6d6f6475666f6c696f2f707372373f746f6b656e3d3749543352534f56324b267374796c653d666c61742d737175617265)](https://codecov.io/gh/modufolio/psr7)

PSR-7 HTTP message implementation with additional utilities for building HTTP applications.

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

[](#installation)

```
composer require modufolio/http
```

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- PSR-7 HTTP Message interfaces
- PSR-17 HTTP Factory interfaces

Features
--------

[](#features)

This package provides a complete PSR-7 implementation including:

- **Request/Response**: Full PSR-7 HTTP message implementation
- **ServerRequest**: Server-side request handling with superglobal parsing and automatic body parsing
- **Uri**: URI parsing and manipulation
- **Stream**: Stream implementation for request/response bodies
- **UploadedFile**: File upload handling with validation
- **Emitter**: Response emitters for sending HTTP responses
- **ServerRequestCreator**: Factory for creating ServerRequest from globals
- **ServerRequestCreatorFactory**: Static factory for creating ServerRequestCreator instances
- **Static Response Helpers**: Convenient methods for creating common HTTP responses (JSON, HTML, redirects, etc.)
- **Body Parsers**: Built-in parsers for JSON, XML, and form data with extensible parser registration

Usage
-----

[](#usage)

### Creating a Response

[](#creating-a-response)

```
use Modufolio\Psr7\Http\Response;

$response = new Response(200, ['Content-Type' => 'application/json'], '{"message":"Hello"}');
```

### Creating a ServerRequest from globals

[](#creating-a-serverrequest-from-globals)

```
use Modufolio\Psr7\Http\ServerRequestCreator;

$creator = new ServerRequestCreator();
$request = $creator->fromGlobals();
```

### Working with Streams

[](#working-with-streams)

```
use Modufolio\Psr7\Http\Stream;

$stream = Stream::create('Hello World');
echo $stream->getContents(); // "Hello World"
```

### Using ServerRequestCreatorFactory

[](#using-serverrequestcreatorfactory)

```
use Modufolio\Psr7\Http\Factory\ServerRequestCreatorFactory;

$creator = ServerRequestCreatorFactory::create();
$request = $creator->fromGlobals();
```

### Static Response Helpers

[](#static-response-helpers)

```
use Modufolio\Psr7\Http\Response;

// Create JSON responses
$response = Response::json(['message' => 'Hello World'], 200);

// Create HTML responses
$response = Response::html('Hello World');

// Create redirects
$response = Response::redirect('https://example.com', 302);

// Create error responses
$response = Response::unauthorized('Invalid credentials');
$response = Response::tooManyRequests('Rate limit exceeded');
```

### Automatic Body Parsing in ServerRequest

[](#automatic-body-parsing-in-serverrequest)

```
use Modufolio\Psr7\Http\ServerRequestCreator;

$creator = new ServerRequestCreator();
$request = $creator->fromGlobals();

// Automatically parses JSON, XML, and form data
$parsedBody = $request->getParsedBody();
```

### Emitting Responses

[](#emitting-responses)

```
use Modufolio\Psr7\Http\Response;
use Modufolio\Psr7\Http\Emitter;

$response = Response::json(['status' => 'success']);
$emitter = new Emitter();
$emitter->emit($response); // Sends headers and body to client
```

License
-------

[](#license)

MIT

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance56

Moderate activity, may be stable

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/44315162577333baa74802d06e9c5dd2f3a44117b45551faa8e1d50b9d7b0c78?d=identicon)[modufolio](/maintainers/modufolio)

---

Top Contributors

[![modufolio](https://avatars.githubusercontent.com/u/18153996?v=4)](https://github.com/modufolio "modufolio (17 commits)")

### Embed Badge

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

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

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78026.4M414](/packages/react-http)[php-http/curl-client

PSR-18 and HTTPlug Async client with cURL

48347.0M384](/packages/php-http-curl-client)[smi2/phpclickhouse

PHP ClickHouse Client

84310.1M71](/packages/smi2-phpclickhouse)

PHPackages © 2026

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