PHPackages                             fast-forward/http-factory - 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. fast-forward/http-factory

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

fast-forward/http-factory
=========================

Fast Forward PSR-7 HTTP Factory utility classes

v1.2.0(3mo ago)03421MITPHPPHP ^8.3CI passing

Since May 6Pushed 2mo agoCompare

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

READMEChangelog (4)Dependencies (12)Versions (5)Used By (1)

FastForward HTTP Factory
========================

[](#fastforward-http-factory)

[![PHP Version](https://camo.githubusercontent.com/c9b19f1cbf8aefb8c278c8b5d392b64401164a08fced6ccbf376b32135d6714f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e332d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://www.php.net/releases/)[![Composer Package](https://camo.githubusercontent.com/710fbe935d909c5c37ec8a4e9e6c34ea40c4f5c33410dd41b4ccea0996f45098/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f6d706f7365722d666173742d2d666f7277617264253246687474702d2d666163746f72792d4632384431412e7376673f6c6f676f3d636f6d706f736572266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/fast-forward/http-factory)[![Tests](https://camo.githubusercontent.com/96bf105e88c102782e3d4cf7d1e2dc017c53f4b2ec2b1fb26386f2baf4331de9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7068702d666173742d666f72776172642f687474702d666163746f72792f74657374732e796d6c3f6c6f676f3d676974687562616374696f6e73266c6f676f436f6c6f723d7768697465266c6162656c3d746573747326636f6c6f723d323243353545)](https://github.com/php-fast-forward/http-factory/actions/workflows/tests.yml)[![Coverage](https://camo.githubusercontent.com/783041b70aa9cfca2a0969ddc49e11178a3367b14165ef787853fdc3075f43b3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f7665726167652d706870756e69742d3441444538303f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://php-fast-forward.github.io/http-factory/coverage/index.html)[![Docs](https://camo.githubusercontent.com/6744bcf84ec37b1a460b0a6a0c38ddc77ee9654ecbc9a3972d50d9fa20bf158c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6465706c6f796d656e74732f7068702d666173742d666f72776172642f687474702d666163746f72792f6769746875622d70616765733f6c6f676f3d72656164746865646f6373266c6f676f436f6c6f723d7768697465266c6162656c3d646f6373266c6162656c436f6c6f723d31453239334226636f6c6f723d333842444638267374796c653d666c6174)](https://php-fast-forward.github.io/http-factory/index.html)[![License](https://camo.githubusercontent.com/f5d3e0c45a79e4e81cab94bcc3bf3780f0944130d2a4764328ad6b57da9c1e90/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7068702d666173742d666f72776172642f687474702d666163746f72793f636f6c6f723d363437343842)](LICENSE)[![GitHub Sponsors](https://camo.githubusercontent.com/d61f432861a7c60e0a9620738dffd3b884bcf392c86e48a2cc87ea57a077e90a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73706f6e736f72732f7068702d666173742d666f72776172643f6c6f676f3d67697468756273706f6e736f7273266c6f676f436f6c6f723d776869746526636f6c6f723d454334383939)](https://github.com/sponsors/php-fast-forward)

[![PSR-11](https://camo.githubusercontent.com/1476c9bd279218794173c3d24e2c9ec06bedb3bfcff397debe19894ea360a303/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5053522d2d31312d636f6e7461696e65722d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://www.php-fig.org/psr/psr-11/)[![PSR-17](https://camo.githubusercontent.com/b1c283713e2712b79938090b98ad4a1d77956f8150f083d78c63ee4d660bbbcd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5053522d2d31372d687474702d2d666163746f72792d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://www.php-fig.org/psr/psr-17/)

A Fast Forward service provider and helper-factory package for [PSR-17](https://www.php-fig.org/psr/psr-17/) and [PSR-7](https://www.php-fig.org/psr/psr-7/) HTTP objects, built on top of [Nyholm PSR-7](https://github.com/Nyholm/psr7) and [Nyholm ServerRequestCreator](https://github.com/Nyholm/psr7-server).

Designed to work out of the box with the [`php-fast-forward/container`](https://github.com/php-fast-forward/container) autowiring system.

---

📦 Installation
--------------

[](#-installation)

```
composer require fast-forward/http-factory
```

Features
--------

[](#features)

- Reuses one `Nyholm\Psr7\Factory\Psr17Factory` instance for the standard PSR-17 interfaces
- Registers `Nyholm\Psr7Server\ServerRequestCreator` and exposes `ServerRequestInterface::class` via `fromGlobals()`
- Exposes `FastForward\Http\Message\Factory\ResponseFactoryInterface` for HTML, JSON, text, redirect, and no-content helpers
- Exposes `FastForward\Http\Message\Factory\StreamFactoryInterface` for payload-aware JSON stream helpers
- Keeps returned objects PSR-7 compatible

Usage
-----

[](#usage)

There are two similarly named response and stream factory interfaces:

- `Psr\Http\Message\ResponseFactoryInterface` and `Psr\Http\Message\StreamFactoryInterface` for plain PSR-17 behavior
- `FastForward\Http\Message\Factory\ResponseFactoryInterface` and `FastForward\Http\Message\Factory\StreamFactoryInterface` for Fast Forward helper methods

If you’re using `fast-forward/container`:

```
use FastForward\Container\container;
use FastForward\Config\ArrayConfig;
use FastForward\Container\ContainerInterface;

$config = new ArrayConfig([
    ContainerInterface::class => [
        // Reference the service provider by class name
        HttpMessageFactoryServiceProvider::class,
    ],
]);

$container = container($config);

$requestFactory = $container->get(Psr\Http\Message\RequestFactoryInterface::class);
$serverRequest = $container->get(Psr\Http\Message\ServerRequestInterface::class);
$responseFactory = $container->get(FastForward\Http\Message\Factory\ResponseFactoryInterface::class);
$streamFactory = $container->get(FastForward\Http\Message\Factory\StreamFactoryInterface::class);

$request = $requestFactory->createRequest('GET', '/health');

$jsonResponse = $responseFactory->createResponseFromPayload(['ok' => true]);
$htmlResponse = $responseFactory->createResponseFromHtml('Hello');
$redirectResponse = $responseFactory->createResponseRedirect('/login');
$noContentResponse = $responseFactory->createResponseNoContent();

$acceptedResponse = $responseFactory
    ->createResponse(202)
    ->withHeader('Content-Type', 'application/json; charset=utf-8')
    ->withBody($streamFactory->createStreamFromPayload(['queued' => true]));
```

Services Registered
-------------------

[](#services-registered)

The following services will be automatically registered in your container when using `HttpMessageFactoryServiceProvider`:

Service InterfaceImplementation Source`Psr\Http\Message\RequestFactoryInterface``Nyholm\Psr7\Factory\Psr17Factory` (via alias)`Psr\Http\Message\ResponseFactoryInterface``Nyholm\Psr7\Factory\Psr17Factory` (via alias)`Psr\Http\Message\ServerRequestFactoryInterface``Nyholm\Psr7\Factory\Psr17Factory` (via alias)`Psr\Http\Message\StreamFactoryInterface``Nyholm\Psr7\Factory\Psr17Factory` (via alias)`Psr\Http\Message\UploadedFileFactoryInterface``Nyholm\Psr7\Factory\Psr17Factory` (via alias)`Psr\Http\Message\UriFactoryInterface``Nyholm\Psr7\Factory\Psr17Factory` (via alias)`Nyholm\Psr7Server\ServerRequestCreatorInterface``Nyholm\Psr7Server\ServerRequestCreator` (via alias)`FastForward\Http\Message\Factory\ResponseFactoryInterface``FastForward\Http\Message\Factory\ResponseFactory` (via alias)`FastForward\Http\Message\Factory\StreamFactoryInterface``FastForward\Http\Message\Factory\StreamFactory` (via alias)`Nyholm\Psr7\Factory\Psr17Factory`Registered via `InvokableFactory``Nyholm\Psr7Server\ServerRequestCreator`Registered via `InvokableFactory`, with dependencies`FastForward\Http\Message\Factory\ResponseFactory`Registered via `InvokableFactory``FastForward\Http\Message\Factory\StreamFactory`Registered via `InvokableFactory``Psr\Http\Message\ServerRequestInterface`Created by calling `fromGlobals()` on `ServerRequestCreator` via `MethodFactory`Documentation
-------------

[](#documentation)

The Sphinx documentation under [`docs/`](docs/) covers:

- beginner installation and quickstart flows
- concrete `ResponseFactory` and `StreamFactory` classes
- common response and payload-stream scenarios
- alias mapping, compatibility, dependencies, and troubleshooting

License
-------

[](#license)

This package is open-source software licensed under the [MIT License](https://opensource.org/licenses/MIT).

Contributing
------------

[](#contributing)

Contributions, issues, and feature requests are welcome!
Feel free to open a [GitHub Issue](https://github.com/php-fast-forward/http-factory/issues) or submit a Pull Request.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance83

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.4% 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

Every ~108 days

Total

4

Last Release

96d ago

PHP version history (3 changes)v1.0.0PHP ^8.1

v1.1.0PHP ^8.2

v1.2.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/bb658791d4db57e57ac164a268f94340ddff4d1ee0aad1358d4593847051a9fe?d=identicon)[coisa](/maintainers/coisa)

---

Top Contributors

[![coisa](https://avatars.githubusercontent.com/u/426835?v=4)](https://github.com/coisa "coisa (17 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

http-factoryphpphp-librarypsr-7service-provider

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fast-forward-http-factory/health.svg)

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

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

8.0k1.1B4.0k](/packages/guzzlehttp-psr7)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[mezzio/mezzio

PSR-15 Middleware Microframework

3923.8M125](/packages/mezzio-mezzio)[laudis/neo4j-php-client

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

185702.8k43](/packages/laudis-neo4j-php-client)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28150.5k](/packages/phpro-http-tools)[mezzio/mezzio-authentication-oauth2

OAuth2 (server) authentication middleware for Mezzio and PSR-7 applications.

28591.3k3](/packages/mezzio-mezzio-authentication-oauth2)

PHPackages © 2026

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