PHPackages                             qa-data/psr7-http-message - 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. qa-data/psr7-http-message

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

qa-data/psr7-http-message
=========================

HTTP message interface

v1.1(1y ago)01.1kMITPHPPHP &gt;=8.1

Since Oct 1Pushed 1y ago1 watchersCompare

[ Source](https://github.com/qa-data/psr7-http-message)[ Packagist](https://packagist.org/packages/qa-data/psr7-http-message)[ RSS](/packages/qa-data-psr7-http-message/feed)WikiDiscussions main Synced yesterday

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

PSR-7 HTTP Message
==================

[](#psr-7-http-message)

`PSR-7` is HTTP message interface. It's very useful interface especially for middleware / relay pattern. Read more on official [PHP-FIG](http://www.php-fig.org/psr/psr-7/) website.

This package is based on a package from the guys at Contributte - [PSR-7 HTTP Message](https://github.com/contributte/psr7-http-message), which is based on [guzzle/psr7](https://github.com/guzzle/psr7).

---

Usage
-----

[](#usage)

To install latest version of `qa-data/psr7-http-message` use [Composer](https://getcomposer.org).

```
composer require qa-data/psr7-http-message
```

`Psr7Request`
-------------

[](#psr7request)

The easiest way is to create request using `Psr7RequestFactory`.

```
use Contributte\Psr7\Psr7RequestFactory;

$psr7 = Psr7RequestFactory::fromGlobals();
```

Additional methods (against PSR7 interface):

- of(RequestInterface $request): self
- getContents(): mixed
- getContentsCopy(): mixed
- getJsonBody(bool $associative = true): mixed
- getJsonBodyCopy(bool $associative = true): mixed

`Psr7ServerRequest`
-------------------

[](#psr7serverrequest)

Additional methods (against PSR7 interface):

- of(ServerRequestInterface $request): self
- fromGlobals(): self
- withAttributes(array $attributes): self
- hasQueryParam(string $name): bool
- getQueryParam(string $name, mixed $default = null): mixed

`Psr7Response`
--------------

[](#psr7response)

The easiest way is to create request using `Psr7ResponseFactory`.

```
use Contributte\Psr7\Psr7ResponseFactory;

$psr7 = Psr7ResponseFactory::fromGlobal();
```

Additional methods (against PSR7 interface):

- of(ResponseInterface $response): self
- fromGlobals(): self
- appendBody(mixed $body): self
- rewindBody(): self
- writeBody(mixed $body): self
- writeJsonBody(array $data): self
- writeJsonObject(JsonSerializable $object): self
- getJsonBody(bool $associative = true): mixed
- getContents(bool $rewind = true): mixed
- withHeaders(array $headers): self
- send(): void
- sendHeaders(): void
- sendBody(): void

API
---

[](#api)

**MessageInterface**

- `getProtocolVersion: string`
- `withProtocolVersion(string $version): static`
- `getHeaders(): array`
- `hasHeader(string $name): bool`
- `getHeader(string $name): string[]`
- `getHeaderLine(string $name): string`
- `withHeader(string $name, string|string[] $value): static`
- `withAddedHeader(string $name, string|string[] $value): static`
- `withoutHeader(string $name): static`
- `getBody(): StreamInterface`
- `withBody(StreamInterface $body): static`

**RequestInterface** &lt;&lt; **MessageInterface**

- `getRequestTarget(): string`
- `withRequestTarget($requestTarget): static`
- `getMethod(): string`
- `withMethod(string $method): static`

**ServerRequestInterface** &lt;&lt; **RequestInterface**

- `getServerParams(): array`
- `getCookieParams(): array`
- `withCookieParams(array $cookies): static`
- `getQueryParams(): array`
- `withQueryParams(array $query): static`
- `getUploadedFiles(): UploadedFileInterface[]`
- `withUploadedFiles(array $uploadedFiles): static`
- `getParsedBody(): mixed`
- `withParsedBody($data): static`
- `getAttributes(): mixed[]`
- `getAttribute(string $name, $default = null): mixed`
- `withAttribute(string $name, $value): static`
- `withoutAttribute(string $name): static`

**ResponseInterface** &lt;&lt; **MessageInterface**

- `getStatusCode(): int`
- `withStatus(int $code, string $reasonPhrase = ''): static`
- `getReasonPhrase(): string`

**StreamInterface**

- `__toString(): string`
- `close(): void`
- `detach(): ?resource`
- `getSize(): ?int`
- `tell(): int`
- `eof(): bool`
- `isSeekable(): bool`
- `seek(int $offset, int $whence = SEEK_SET): void`
- `rewind(): void`
- `isWritable(): bool`
- `write($string): void`
- `isReadable(): bool`
- `read($length): string`
- `getContents(): string`
- `getMetadata(?string $key = null): mixed`

**UriInterface**

- `getScheme(): string`
- `withScheme(string $scheme): static`
- `getAuthority(): string`
- `getUserInfo(): string`
- `withUserInfo(string $user, ?string $password = null): static`
- `getHost(): string`
- `withHost(string $host): static`
- `getPort(): ?int`
- `withPort(?int $port): static`
- `getPath(): string`
- `withPath(string $path): static`
- `getQuery(): string`
- `withQuery(string $query): static`
- `getFragment(): string`
- `withFragment(string $fragment): static`
- `__toString(): string`

**UploadedFileInterface**

- `getStream(): StreamInterface`
- `moveTo($targetPath): void`
- `getSize(): ?int`
- `getError(): int`
- `getClientFilename(): ?string`
- `getClientMediaType(): ?string`
-

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 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 ~39 days

Total

2

Last Release

600d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/149055325?v=4)[Igor Počta (SAB)](/maintainers/igorpocta)[@igorpocta](https://github.com/igorpocta)

---

Top Contributors

[![igorpocta2](https://avatars.githubusercontent.com/u/6266721?v=4)](https://github.com/igorpocta2 "igorpocta2 (12 commits)")

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/qa-data-psr7-http-message/health.svg)

```
[![Health](https://phpackages.com/badges/qa-data-psr7-http-message/health.svg)](https://phpackages.com/packages/qa-data-psr7-http-message)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[spatie/crawler

Crawl all internal links found on a website

2.8k18.5M66](/packages/spatie-crawler)[guzzlehttp/guzzle-services

Provides an implementation of the Guzzle Command library that uses Guzzle service descriptions to describe web services, serialize requests, and parse responses into easy to use model structures.

25711.0M191](/packages/guzzlehttp-guzzle-services)[onesignal/onesignal-php-api

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com

34216.9k2](/packages/onesignal-onesignal-php-api)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

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