1: <?php
2:
3: namespace Guzzle\Http\Message;
4:
5: use Guzzle\Common\Collection;
6: use Guzzle\Http\EntityBodyInterface;
7: use Guzzle\Http\Url;
8:
9: /**
10: * Request factory used to create HTTP requests
11: */
12: interface RequestFactoryInterface
13: {
14: /**
15: * Create a new request based on an HTTP message
16: *
17: * @param string $message HTTP message as a string
18: *
19: * @return RequestInterface
20: */
21: public function fromMessage($message);
22:
23: /**
24: * Create a request from URL parts as returned from parse_url()
25: *
26: * @param string $method HTTP method (GET, POST, PUT, HEAD, DELETE, etc)
27: *
28: * @param array $urlParts URL parts containing the same keys as parse_url()
29: * - scheme: e.g. http
30: * - host: e.g. www.guzzle-project.com
31: * - port: e.g. 80
32: * - user: e.g. michael
33: * - pass: e.g. rocks
34: * - path: e.g. / OR /index.html
35: * - query: after the question mark ?
36: * @param array|Collection $headers HTTP headers
37: * @param string|resource|array|EntityBodyInterface $body Body to send in the request
38: * @param string $protocol Protocol (HTTP, SPYDY, etc)
39: * @param string $protocolVersion 1.0, 1.1, etc
40: *
41: * @return RequestInterface
42: */
43: public function fromParts(
44: $method,
45: array $urlParts,
46: $headers = null,
47: $body = null,
48: $protocol = 'HTTP',
49: $protocolVersion = '1.1'
50: );
51:
52: /**
53: * Create a new request based on the HTTP method
54: *
55: * @param string $method HTTP method (GET, POST, PUT, PATCH, HEAD, DELETE, ...)
56: * @param string|Url $url HTTP URL to connect to
57: * @param array|Collection $headers HTTP headers
58: * @param string|resource|array|EntityBodyInterface $body Body to send in the request
59: *
60: * @return RequestInterface
61: */
62: public function create($method, $url, $headers = null, $body = null);
63: }
64: