fulmen/psr7-server

Provides utility a class to handle a PSR-7 server request.

v1.1.0 2020-06-08 13:41 UTC

This package is auto-updated.

Last update: 2020-06-15 10:16:39 UTC


README

Build Status Total Downloads Latest Stable Version License

This package provides a utility class that can create a PSR-7 server request.

Installation

The recommnended way to install this library is through composer:

composer require fulmen/psr7-server

Usage

use Fulmen\Psr7\Factory\ServerRequestFactory;
use Fulmen\Psr7\Factory\UriFactory;
use Fulmen\Psr7\Factory\StreamFactory;
use Fulmen\Psr7\Factory\UploadedFileFactory;
use Fulmen\Psr7\Server\ServerRequestCreator;

// Here is fulmen/http-message as an example
$requestFactory = new ServerRequestFactory();
$uriFactory = new UriFactory();
$streamFactory = new StreamFactory();
$uploadedFileFactory = new UploadedFileFactory();

$requestCreator = new ServerRequestCreator($requestFactory, $uriFactory, $streamFactory, $uploadedFileFactory);
// Create a request from the current environment variables
$request = $requestCreator->fromGlobals();

Testing

composer test

Changelog

Please see the changelog for change details.

License

The package is an open-sourced software licensed under the MIT License.