PHPackages                             kaspi/psr7-wizard - 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. kaspi/psr7-wizard

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

kaspi/psr7-wizard
=================

Make PSR-7 ServerRequest from global variables

v1.3.0(2mo ago)25MITPHPPHP 8.1 - 8.5

Since Jan 30Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/agdobrynin/psr7-wizard)[ Packagist](https://packagist.org/packages/kaspi/psr7-wizard)[ RSS](/packages/kaspi-psr7-wizard/feed)WikiDiscussions development Synced 1mo ago

READMEChangelog (5)Dependencies (7)Versions (7)Used By (0)

🧙🏻‍♂️ psr7-wizard
=================

[](#‍️-psr7-wizard)

Building ServerRequest class which implement PSR-7 ServerRequestInterface from global PHP variables.

Require PHP 8.1 or newest.

additional links: [PSR-7](https://www.php-fig.org/psr/psr-7), [PSR-17](https://www.php-fig.org/psr/psr-17)

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

[](#installation)

```
composer kaspi/psr7-wizard
```

Usage
-----

[](#usage)

```
// Example build ServerRequest class with package kaspi/http-message

$httpFactory = new \Kaspi\HttpMessage\HttpFactory();

$wizard = new \Kaspi\Psr7Wizard\ServerRequestWizard(
    serverRequestFactory: $httpFactory,
    streamFactory: $httpFactory,
    uploadedFileFactory: $httpFactory,
    uriFactory: $httpFactory,
);

/** @var \Psr\Http\Message\ServerRequestInterface $serverRequest */
$serverRequest = $wizard->fromGlobals();

// ✋🏻 Or create by params 👇🏻
$serverEnv = [
    'REMOTE_ADDR' => '127.0.0.1',
    'REMOTE_PORT' => '35096',
    'SERVER_SOFTWARE' => 'PHP 8.2.14 Development Server',
    'SERVER_PROTOCOL' => 'HTTP/1.1',
    'SERVER_NAME' => '127.0.0.1',
    'SERVER_PORT' => '8080',
    'REQUEST_URI' => '/',
    'REQUEST_METHOD' => 'POST',
    'SCRIPT_NAME' => '/index.php',
    'CONTENT_LENGTH' => '53',
    'HTTP_CONTENT_LENGTH' => '53'
];
$queryStringParams = [
    'search' => 'php%',
];
$cookie = [
    'save' => 'no'
];
$uploadedFiles = [
    $httpFactory->createUploadedFile('/tmp/file1');
];
$parsedBody = [
    'form' => [
        'name' => 'Joe',
        'contact' => '+555-36-89'
    ],
];
$body = 'form%5Bname%5D=Joe&form%5Bcontact%5D=%2B555-36-89';

$wizard->fromParams(
    serverParams: $serverEnv,
    queryParams: $queryStringParams,
    cookieParams: $cookie,
    files: $uploadedFiles,
    parsedBody: $parsedBody,
    body: $body
);
```

Development environment
-----------------------

[](#development-environment)

- [Local development](#local-development) (without Docker)
- [With Docker images](#using-docker-image-with-php-81-82-83) (WSL, Linux)

Local development
-----------------

[](#local-development)

Required PHP 8.1 or higher, php Composer 2.x

### Testing

[](#testing)

Run test without code coverage

```
composer test
```

Running tests with checking code coverage by tests with a report in html format

```
./vendor/bin/phpunit
```

Requires installed [PCOV](https://github.com/krakjoe/pcov) driver

*⛑ the results will be in the folder `.coverage-html`*

### Static code analysis

[](#static-code-analysis)

For static analysis we use the package [Phan](https://github.com/phan/phan).

Running without PHP extension [PHP AST](https://github.com/nikic/php-ast)

```
./vendor/bin/phan --allow-polyfill-parser
```

### Code style

[](#code-style)

To bring the code to standards, we use php-cs-fixer which is declared in composer's dev dependencies.

```
composer fixer
```

Using Docker image with PHP 8.1, 8.2, 8.3, 8.4, 8.5
---------------------------------------------------

[](#using-docker-image-with-php-81-82-83-84-85)

You can specify the image with the PHP version in the `.env` file in the `PHP_IMAGE` key. By default, the container is built with the `php:8.1-cli-alpine` image.

Build docker container

```
docker-compose build
```

Install php composer dependencies:

```
docker-compose run --rm php composer install
```

Run tests with a code coverage report and a report in html format

```
docker-compose run --rm php vendor/bin/phpunit
```

⛑ the results will be in the folder `.coverage-html`

Phan (*static analyzer for PHP*)

```
docker-compose run --rm php vendor/bin/phan
```

You can work in a shell into a docker container:

```
docker-compose run --rm php sh
```

##### Using Makefile commands.

[](#using-makefile-commands)

Check and correct code style:

```
make fix
```

Run the static code analyzer:

```
make stat
```

Run tests:

```
make test
```

Run all stages of checks:

```
make all
```

Run test for all support php version:

```
make test-supports-php
```

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance85

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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

Total

5

Last Release

77d ago

PHP version history (3 changes)v1.0.0PHP ^8.1 || ^8.2 || ^8.3

v1.2.0PHP ^8.1 || ^8.2 || ^8.3 || ^8.4

v1.3.0PHP 8.1 - 8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/ae700adf1c969c1b76a10204e7b88afc4a3121e2979bce988b4e9fa5a756a827?d=identicon)[ag.dobrynin](/maintainers/ag.dobrynin)

---

Top Contributors

[![agdobrynin](https://avatars.githubusercontent.com/u/14299950?v=4)](https://github.com/agdobrynin "agdobrynin (24 commits)")

---

Tags

php-librarypsr-17psr-7psr-7http-messagepsr-17

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/kaspi-psr7-wizard/health.svg)

```
[![Health](https://phpackages.com/badges/kaspi-psr7-wizard/health.svg)](https://phpackages.com/packages/kaspi-psr7-wizard)
```

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

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

PSR HTTP message bridge

1.3k296.6M807](/packages/symfony-psr-http-message-bridge)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[laminas/laminas-diactoros

PSR HTTP Message implementations

546105.8M965](/packages/laminas-laminas-diactoros)[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)

PHPackages © 2026

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