PHPackages                             borschphp/httpmessage - 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. borschphp/httpmessage

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

borschphp/httpmessage
=====================

A PSR-7 and PSR-17 implementation.

2.1.0(2y ago)019MITPHPPHP ^8.1

Since Mar 15Pushed 2y agoCompare

[ Source](https://github.com/borschphp/borsch-httpmessage)[ Packagist](https://packagist.org/packages/borschphp/httpmessage)[ RSS](/packages/borschphp-httpmessage/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (13)Used By (0)

Borsch - HTTP Message
=====================

[](#borsch---http-message)

A simple PSR-7 and PSR-17 implementation.
It aims to provide an easy and efficient way to handle HTTP requests and responses.

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

[](#installation)

The package can be installed via [composer](https://getcomposer.org/). Simply run the following command:

`composer require borschphp/httpmessage`

Usage
-----

[](#usage)

### PSR-7

[](#psr-7)

The package provides implementations for the following PSR-7 interfaces:

- `Psr\Http\Message\RequestInterface`
- `Psr\Http\Message\ResponseInterface`
- `Psr\Http\Message\ServerRequestInterface`
- `Psr\Http\Message\StreamInterface`
- `Psr\Http\Message\UriInterface`
- `Psr\Http\Message\UploadedFileInterface`

You can use the factories provided by the package to create instances of these classes:

```
use Borsch\Http\Factory\{
    RequestFactory,
    ResponseFactory
};

$requestFactory = new RequestFactory();
$request = $requestFactory->createRequest('GET', 'https://example.com');

$responseFactory = new ResponseFactory();
$response = $responseFactory->createResponse(200, 'OK');
$response->getBody()->write('Hello world !');
```

### PSR-17

[](#psr-17)

The package also provides factories for the following PSR-17 interfaces:

- `Psr\Http\Message\RequestFactoryInterface`
- `Psr\Http\Message\ResponseFactoryInterface`
- `Psr\Http\Message\ServerRequestFactoryInterface`
- `Psr\Http\Message\StreamFactoryInterface`
- `Psr\Http\Message\UriFactoryInterface`
- `Psr\Http\Message\UploadedFileFactoryInterface`

You can use these factories to create instances of the PSR-7 classes.

### Custom Responses

[](#custom-responses)

The package also includes custom response classes to improve usability and readiness:

- `Borsch\Http\Response\EmptyResponse`
- `Borsch\Http\Response\TextResponse`
- `Borsch\Http\Response\HtmlResponse`
- `Borsch\Http\Response\JsonResponse`
- `Borsch\Http\Response\XmlResponse`
- `Borsch\Http\Response\RedirectResponse`

These classes are built on top of the PSR-7 implementation, and they offer a convenient way to create specific types of responses. For example, instead of creating a response and setting the correct headers and content manually, you can use the `JsonResponse` class to automatically set the `Content-Type` header to `application/json` and the body to the json encoded data.

```
use Borsch\Http\Response\JsonResponse;

$my_json_data = ['foo' => 'bar', 'baz' => 42];

return new JsonResponse($my_json_data);
```

Tests
-----

[](#tests)

The package includes a set of tests (made with [Pest](https://pestphp.com/)) to ensure that everything is working as expected.
You can run the tests by executing the following command:

```
./vendor/bin/pest
```

Mutation testing has also been used to create this package, with `Infection`.
More information on [Infection page](https://infection.github.io/guide/index.html).
To run mutation tests, install `infection` as described in the documentation, then run this command:

```
XDEBUG_MODE=coverage infection
```

An text based and HTML report will be generated in the project folder.

License
-------

[](#license)

The package is licensed under the MIT license. See [License File](https://github.com/borschphp/borsch-httpmessage/blob/master/LICENSE.md)for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~75 days

Recently: every ~91 days

Total

10

Last Release

844d ago

Major Versions

0.0.4 → 1.0.02023-01-23

1.1.1 → 2.0.02023-06-26

PHP version history (4 changes)0.0.1PHP ^7.2|^8.0

0.0.2PHP ^7.2||^8.0

1.0.0PHP ^8.0

2.1.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/0e1a70117520fe10a630d61c750bbe6888d174e9903825e741470f818ee2c5d1?d=identicon)[debuss-a](/maintainers/debuss-a)

---

Top Contributors

[![debuss](https://avatars.githubusercontent.com/u/2537607?v=4)](https://github.com/debuss "debuss (30 commits)")

---

Tags

phppsr-17psr-7httppsr-7http-messagemessagefactorypsr-17

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/borschphp-httpmessage/health.svg)

```
[![Health](https://phpackages.com/badges/borschphp-httpmessage/health.svg)](https://phpackages.com/packages/borschphp-httpmessage)
```

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

8.0k1.0B3.2k](/packages/guzzlehttp-psr7)[psr/http-factory

PSR-17: Common interfaces for PSR-7 HTTP message factories

1.9k692.9M1.9k](/packages/psr-http-factory)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

86874.0k94](/packages/httpsoft-http-message)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[vultr/vultr-php

The Official Vultr API PHP Wrapper.

2243.9k1](/packages/vultr-vultr-php)[chillerlan/php-httpinterface

A PSR-7/17/18 http message/client implementation

1417.1k5](/packages/chillerlan-php-httpinterface)

PHPackages © 2026

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