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

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

kovagoz/http-responder
======================

A simple solution to create PSR-7 compatible HTTP responses.

1.0.0(4y ago)0151MITPHPPHP ^8.0

Since Sep 22Pushed 4y ago1 watchersCompare

[ Source](https://github.com/kovagoz/http-responder)[ Packagist](https://packagist.org/packages/kovagoz/http-responder)[ RSS](/packages/kovagoz-http-responder/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (5)Versions (2)Used By (1)

HTTP Responder
==============

[](#http-responder)

A simple solution to create [PSR-7](https://www.php-fig.org/psr/psr-7/)compatible HTTP responses.

[![phpunit workflow](https://github.com/kovagoz/http-responder/actions/workflows/php.yml/badge.svg)](https://github.com/kovagoz/http-responder/actions/workflows/php.yml/badge.svg)

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

[](#requirements)

- PHP &gt;=8.0

Usage
-----

[](#usage)

#### Instantiate the class:

[](#instantiate-the-class)

```
$responder = new HttpResponder($responseFactory, $streamFactory);
```

#### Create HTML response

[](#create-html-response)

```
$response = $responder->reply('hello world');
```

#### Create JSON response

[](#create-json-response)

```
$response = $responder->reply(['foo' => 'bar']);
```

In this case, response body will be the following:

```
{
  "foo": "bar"
}
```

Furthermore, `Content-Type` header will be set to `application/json`.

#### Create empty response (204 No Content)

[](#create-empty-response-204-no-content)

```
$response = $responder->reply();
```

#### Create redirection

[](#create-redirection)

```
$response = $responder->redirect('https://example.com/');
```

Default status code is `302`. You can change it on the response object by the `withStatus()` method.

You can also pass `UriInterface` object to the `redirect()` method instead of string URL.

Testing
-------

[](#testing)

This repository contains a Makefile which aids to run unit tests on your computer using a Docker container.

Just run the command below, sit back and watch results.

```
make test
```

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity56

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

1744d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/664c17e6a7f99c063d1734e49da5623df8d9e91a30a692fcbb10bfc375eff43b?d=identicon)[kovagoz](/maintainers/kovagoz)

---

Tags

phppsr-7

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  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)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[laudis/neo4j-php-client

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

185702.8k43](/packages/laudis-neo4j-php-client)[mezzio/mezzio

PSR-15 Middleware Microframework

3923.8M125](/packages/mezzio-mezzio)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)

PHPackages © 2026

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