# Class HttpSoft\Message\RequestFactory

Factory for creating HttpSoft\Message\Request and implements Psr\Http\Message\RequestFactoryInterface.

Source code on GitHub.

use HttpSoft\Message\RequestFactory;

$factory = new RequestFactory();
$request = $factory->createRequest('GET', 'http://example.com');
$request->getMethod(); // 'GET'
$request->getProtocolVersion(); // '1.1'
$request->getBody()->getContents(); // ''
(string) $request->getUri(); // 'http://example.com'
$request->getHeaders(); // ['Host' => ['example.com']]

# Public methods

See the original detailed description of the methods in the Psr\Http\Message\RequestFactoryInterface.

# createRequest

Create a new HttpSoft\Message\Request instance.

/**
 * @param string $method
 * @param UriInterface|string $uri
 * @return RequestInterface
 */
public function createRequest(string $method, $uri): RequestInterface;