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

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

tuupola/http-factory
====================

Lightweight autodiscovering PSR-17 HTTP factories

1.4.0(4y ago)174.4M↓36.3%6[2 issues](https://github.com/tuupola/http-factory/issues)16MITPHPPHP ^7.1|^8.0CI failing

Since May 30Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/tuupola/http-factory)[ Packagist](https://packagist.org/packages/tuupola/http-factory)[ Docs](https://github.com/tuupola/http-factory)[ GitHub Sponsors](https://github.com/tuupola)[ RSS](/packages/tuupola-http-factory/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (5)Versions (17)Used By (16)

Autodiscovering PSR-17 HTTP Factories
=====================================

[](#autodiscovering-psr-17-http-factories)

[![Latest Version](https://camo.githubusercontent.com/7f71b001dd3092c4dae1f52a3ffb6169c1483a1f394d5a584e47652e5ac456b7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f747575706f6c612f687474702d666163746f72792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tuupola/http-factory)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/05b9cc57da16b1f37b98a46dafdfe25ccd4160f8b3837146e746a5bedee707e0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f747575706f6c612f687474702d666163746f72792f74657374732e796d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://github.com/tuupola/http-factory/actions)[![Coverage](https://camo.githubusercontent.com/a50cf43280d788e0bad95b84986f7b85ff7908db19314766afab83b2d821a47c/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f747575706f6c612f687474702d666163746f72792e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/github/tuupola/http-factory)

Install
-------

[](#install)

Install the library using [Composer](https://getcomposer.org/).

```
$ composer require tuupola/http-factory
```

Usage
-----

[](#usage)

Let's assume you have Diactoros installed.

```
$ composer require zendframework/zend-diactoros

```

The factories will now automatically return Diactoros PSR-7 instances.

```
use Tuupola\Http\Factory\RequestFactory;

$request = (new RequestFactory)->createRequest("GET", "https://example.com/");
print get_class($request); /* Zend\Diactoros\Request */
```

On the other hand if you have Slim frameworks installed.

```
$ composer remove zendframework/zend-diactoros
$ composer require slim/slim

```

The factories will now return Slim PSR-7 instances.

```
use Tuupola\Http\Factory\RequestFactory;

$request = (new RequestFactory)->createRequest("GET", "https://example.com/");
print get_class($request); /* Slim\Http\Request */
```

This library currently automatically detects and supports [laminas/laminas-diactoros](https://github.com/laminas/laminas-diactoros), [zendframework/zend-diactoros](https://github.com/zendframework/zend-diactoros), [slim/slim](https://github.com/slimphp/slim), [slim/psr7](https://github.com/slimphp/Slim-Psr7), [nyholm/psr7](https://github.com/Nyholm/psr7) and [guzzle/psr7](https://github.com/guzzle/psr7) PSR-7 implementations.

Testing
-------

[](#testing)

You can run tests either manually or automatically on every code change. Automatic tests require [entr](http://entrproject.org/) to work.

```
$ make test
```

```
$ brew install entr
$ make watch
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance43

Moderate activity, may be stable

Popularity52

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 97.2% 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 ~120 days

Recently: every ~244 days

Total

14

Last Release

1754d ago

Major Versions

0.4.2 → 1.0.02018-10-12

PHP version history (2 changes)0.4.0PHP ^7.1

1.2.0PHP ^7.1|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/3325405a7d8a43bc40dd0e760a4b7f268fba32a7150cf0327f64f13d1661df0b?d=identicon)[tuupola](/maintainers/tuupola)

---

Top Contributors

[![tuupola](https://avatars.githubusercontent.com/u/21913?v=4)](https://github.com/tuupola "tuupola (69 commits)")[![dakujem](https://avatars.githubusercontent.com/u/443067?v=4)](https://github.com/dakujem "dakujem (1 commits)")[![solcik](https://avatars.githubusercontent.com/u/1543737?v=4)](https://github.com/solcik "solcik (1 commits)")

---

Tags

httppsr-7psr-17

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

8.0k1.1B4.0k](/packages/guzzlehttp-psr7)[http-interop/http-factory-guzzle

An HTTP Factory using Guzzle PSR7

582175.4M651](/packages/http-interop-http-factory-guzzle)[laminas/laminas-diactoros

PSR HTTP Message implementations

548115.3M1.2k](/packages/laminas-laminas-diactoros)[mezzio/mezzio

PSR-15 Middleware Microframework

3923.8M126](/packages/mezzio-mezzio)[laminas/laminas-stratigility

PSR-7 middleware foundation for building and dispatching middleware pipelines

587.2M101](/packages/laminas-laminas-stratigility)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28150.5k](/packages/phpro-http-tools)

PHPackages © 2026

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