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

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

pew-pew/http-factory
====================

HTTP factory for decoding request and encoding responses with symfony integration

0.1.0(2y ago)33.1k↑25%MITPHPPHP ^8.3

Since Mar 17Pushed 2y ago1 watchersCompare

[ Source](https://github.com/pew-pew-team/http-factory)[ Packagist](https://packagist.org/packages/pew-pew/http-factory)[ RSS](/packages/pew-pew-http-factory/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (10)Versions (2)Used By (0)

 [![](https://raw.githubusercontent.com/pew-pew-team/.github/master/assets/logo.svg)](https://github.com/pew-pew-team)

 [![PHP 8.3+](https://camo.githubusercontent.com/5bcac41cb1279da78888d49ce74965ebabc9f834816a7b6ffc963fef7a91e677/68747470733a2f2f706f7365722e707567782e6f72672f7065772d7065772f687474702d666163746f72792f726571756972652f7068703f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/pew-pew/http-factory) [![Latest Stable Version](https://camo.githubusercontent.com/2e2c7081b2264cb01ed5aadd44a51dd830550137a54e52d0860a59aaa3e327f4/68747470733a2f2f706f7365722e707567782e6f72672f7065772d7065772f687474702d666163746f72792f76657273696f6e3f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/pew-pew/http-factory) [![Latest Unstable Version](https://camo.githubusercontent.com/02740a07a1f095adf489c2d3815710761d95cd435389a3e25c49463b9cfae34b/68747470733a2f2f706f7365722e707567782e6f72672f7065772d7065772f687474702d666163746f72792f762f756e737461626c653f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/pew-pew/http-factory) [![License MIT](https://camo.githubusercontent.com/180a5795e1640939aa2e74733efd58c62e2dd8ba955f789990aa2cda67908260/68747470733a2f2f706f7365722e707567782e6f72672f7065772d7065772f687474702d666163746f72792f6c6963656e73653f7374796c653d666f722d7468652d6261646765)](https://raw.githubusercontent.com/pew-pew-team/http-factory/blob/master/LICENSE)

 [![](https://github.com/pew-pew-team/http-factory/workflows/tests/badge.svg)](https://github.com/pew-pew-team/http-factory/actions) [![](https://github.com/pew-pew-team/http-factory/workflows/codestyle/badge.svg)](https://github.com/pew-pew-team/http-factory/actions) [![](https://github.com/pew-pew-team/http-factory/workflows/security/badge.svg)](https://github.com/pew-pew-team/http-factory/actions) [![](https://github.com/pew-pew-team/http-factory/workflows/static-analysis/badge.svg)](https://github.com/pew-pew-team/http-factory/actions)

HTTP Factory
============

[](#http-factory)

A set of drivers for encoding HTTP responses and decoding HTTP requests.

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

[](#installation)

PewPew HTTP Factory is available as Composer repository and can be installed using the following command in a root of your project:

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

More detailed installation [instructions are here](https://getcomposer.org/doc/01-basic-usage.md).

Usage
-----

[](#usage)

### Decoder

[](#decoder)

```
// Symfony Request
$request = new \Symfony\Component\HttpFoundation\Request();

// Requests Factory
$requests = new \PewPew\HttpFactory\RequestDecoderFactory([
    new \PewPew\HttpFactory\Driver\JsonDriver(),
]);

$payload = $requests
    ->createDecoder($request) // Detect passed "content-type" header and
                              // create decoder if available.
    ?->decode($request->getContent(true));   // Decode request body.
```

### Encoder

[](#encoder)

```
// Symfony Request
$request = new \Symfony\Component\HttpFoundation\Request();

// Responses Factory
$responses = new \PewPew\HttpFactory\ResponseEncoderFactory([
    new \PewPew\HttpFactory\Driver\JsonDriver(),
]);

$response = $responses
    ->createEncoder($request) // Detect passed "accept" header and create
                              // encoder if available.
    ?->encode(['some' => 'any'], 200);  // Encode payload and create response.
```

### Symfony Integration

[](#symfony-integration)

Add the bundle to your `bundles.php` file:

```
// bundles.php
return [
    // ...
    PewPew\HttpFactory\HttpFactoryBundle::class => ['all' => true],
];
```

Use `ResponseEncoderFactoryInterface` and `RequestDecoderFactoryInterface`in your services:

```
use PewPew\HttpFactory\ResponseEncoderFactoryInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;

final readonly class ExampleController
{
    public function __construct(
        private ResponseEncoderFactoryInterface $responses,
    ) {}

    public function someAction(Request $request): Response
    {
        $encoder = $this->responses->createEncoder($request);

        if ($encoder === null) {
            throw new \Symfony\Component\HttpFoundation\Exception\BadRequestException(
                'Unsupported "accept" request header',
            );
        }

        return $encoder->encode([
            'status' => 'ok'
        ], Response::HTTP_OK);
    }
}
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

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

783d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/150420?v=4)[Ruslan Sharipov](/maintainers/Serafim)[@serafim](https://github.com/serafim)

---

Tags

acceptbundlecontent-typedecoderencoderfactoryhttprequestresponsesymfonysymfony-bundle

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[symfony/http-kernel

Provides a structured process for converting a Request into a Response

8.1k822.4M6.7k](/packages/symfony-http-kernel)[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k63.6M232](/packages/nelmio-api-doc-bundle)[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k48.1M234](/packages/api-platform-core)[friendsofsymfony/http-cache-bundle

Set path based HTTP cache headers and send invalidation requests to your HTTP cache

43813.2M47](/packages/friendsofsymfony-http-cache-bundle)[illuminate/http

The Illuminate Http package.

11936.0M5.0k](/packages/illuminate-http)[api-platform/http-cache

API Platform HttpCache component

223.2M7](/packages/api-platform-http-cache)

PHPackages © 2026

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