Skip to content
Helper classes to use any PSR7 implementation as your main request and response
Branch: master
Clone or download
mindplay-dk and Zegnat Add missing support for Host-header with port-number (#26)
The `Host` header, according to [RFC2616 section 14.23](, may contain a port-number.

The current implementation doesn't handle this, and effectively ends up producing an `UriInterface` instance that returns a host-name string with the port-number inside it.

PSR-7 actually isn't explicit on this point, but I'd have to assume that, since there's a `getPort()` method for obtaining the port-number, then `getHost()` isn't supposed to also return the port-number, just the host-name.

This PR includes a regression-test (which did fail) and a fix, as well as regression tests for IPv6 host/port + some additional tests for IP names
Latest commit 4d03768 Feb 3, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Add missing support for Host-header with port-number (#26) Feb 3, 2019
.editorconfig Init commit Jul 28, 2018
.gitattributes Init commit Jul 28, 2018
.gitignore Init commit Jul 28, 2018
.php_cs Code style fixes (#12) Aug 2, 2018
.scrutinizer.yml typo Jul 28, 2018
.travis.yml Added BC test (#24) Feb 3, 2019
LICENSE Update Aug 1, 2018
phpunit.xml.dist Init commit Jul 28, 2018

Helper class to create PSR-7 server request

Latest Version Build Status Code Coverage Quality Score Total Downloads Monthly Downloads Software License

A helper class that can create ANY PSR-7 server request.


composer require nyholm/psr7-server


// Instanciate ANY PSR-17 factory implementations. Here is nyholm/psr7 as an example
$psr17Factory = new \Nyholm\Psr7\Factory\Psr17Factory();

$creator = new \Nyholm\Psr7Server\ServerRequestCreator(
    $psr17Factory, // ServerRequestFactory
    $psr17Factory, // UriFactory
    $psr17Factory, // UploadedFileFactory
    $psr17Factory  // StreamFactory

$serverRequest = $creator->fromGlobals();

Other packages

You can’t perform that action at this time.