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.0kMITPHPPHP &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 1mo ago

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

30

—

LowBetter than 65% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity17

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

545d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7767e0ba6c49982f1045eae9d9e1157507789132da607f9c79a019879e4ed446?d=identicon)[igorpocta](/maintainers/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

[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)[onesignal/onesignal-php-api

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

34170.2k2](/packages/onesignal-onesignal-php-api)[zenditplatform/zendit-php-sdk

PHP client for Zendit API

1204.3k](/packages/zenditplatform-zendit-php-sdk)[elasticemail/elasticemail-php

This API is based on the REST API architecture, allowing the user to easily manage their data with this resource-based approach. Every API call is established on which specific request type (GET, POST, PUT, DELETE) will be used. The API has a limit of 20 concurrent connections and a hard timeout of 600 seconds per request. To start using this API, you will need your Access Token (available &lt;a target='\_blank' href='https://app.elasticemail.com/marketing/settings/new/manage-api'&gt;here&lt;/a&gt;). Remember to keep it safe. Required access levels are listed in the given request’s description. Downloadable library clients can be found in our Github repository &lt;a target='\_blank' href='https://github.com/ElasticEmail?tab=repositories&amp;q=%22rest+api%22+in%3Areadme'&gt;here&lt;/a&gt;

1595.0k2](/packages/elasticemail-elasticemail-php)[ory/kratos-client-php

This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more.

1529.2k3](/packages/ory-kratos-client-php)

PHPackages © 2026

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