Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/geggleto/request-factory

Turn raw HTTP Strings into PSR-7 Requests
https://github.com/geggleto/request-factory

Last synced: 5 days ago
JSON representation

Turn raw HTTP Strings into PSR-7 Requests

Awesome Lists containing this project

README

        

# request-factory
Turn raw HTTP Strings into PSR-7 Requests

# Usage

```php
// ...
use \Geggleto\Foundation\Factory\ServerRequestFactory;

$factory = new ServerRequestFactory();

$request = $factory->parseFromString("GET /docs/index.html HTTP/1.1
Host: http://www.test101.com
Accept: image/gif, image/jpeg, */*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");

// $request is PSR-7!
```