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

ActiveLibrary

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 4w ago

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

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

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

1690d 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

[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[swisnl/json-api-client

A PHP package for mapping remote JSON:API resources to Eloquent like models and collections.

211473.2k12](/packages/swisnl-json-api-client)[laudis/neo4j-php-client

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

184616.9k31](/packages/laudis-neo4j-php-client)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[neos/flow

Flow Application Framework

862.0M450](/packages/neos-flow)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

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

PHPackages © 2026

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