fulmen / psr7-server
Provides utility a class to handle a PSR-7 server request.
v1.1.0
2020-06-08 13:41 UTC
Requires
- php: ^7.2
- kuyoto/getallheaders: ^1.0
- psr/http-factory: ^1.0
- psr/http-message: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16.3
- fulmen/psr7: ^1.0
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2020-06-15 10:16:39 UTC
README
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.