39 lines
1.7 KiB
Markdown
39 lines
1.7 KiB
Markdown
|
# Helper class to create PSR-7 server request
|
||
|
|
||
|
[](https://github.com/Nyholm/psr7-server/releases)
|
||
|
[](https://travis-ci.org/Nyholm/psr7-server)
|
||
|
[](https://scrutinizer-ci.com/g/Nyholm/psr7-server)
|
||
|
[](https://scrutinizer-ci.com/g/Nyholm/psr7-server)
|
||
|
[](https://packagist.org/packages/nyholm/psr7-server)
|
||
|
[](https://packagist.org/packages/nyholm/psr7-server)
|
||
|
[](LICENSE)
|
||
|
|
||
|
A helper class that can create ANY PSR-7 server request.
|
||
|
|
||
|
## Installation
|
||
|
|
||
|
```bash
|
||
|
composer require nyholm/psr7-server
|
||
|
```
|
||
|
|
||
|
## Usage
|
||
|
|
||
|
```php
|
||
|
// 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
|
||
|
|
||
|
* [nyholm/psr7](https://github.com/Nyholm/psr7) - A super fast PSR-7 implementation.
|
||
|
* [zendframework/zend-httphandlerrunner](https://github.com/zendframework/zend-httphandlerrunner) - To send/emit PSR-7 responses
|