@@ -52,24 +52,19 @@ Event-driven, streaming plaintext HTTP and secure HTTPS server for [ReactPHP](ht
5252 * [ delete()] ( #delete )
5353 * [ request()] ( #request )
5454 * [ requestStreaming()] ( #requeststreaming )
55- * [ ~~ submit()~~ ] ( #submit )
56- * [ ~~ send()~~ ] ( #send )
5755 * [ withTimeout()] ( #withtimeout )
5856 * [ withFollowRedirects()] ( #withfollowredirects )
5957 * [ withRejectErrorResponse()] ( #withrejecterrorresponse )
6058 * [ withBase()] ( #withbase )
6159 * [ withProtocolVersion()] ( #withprotocolversion )
6260 * [ withResponseBuffer()] ( #withresponsebuffer )
63- * [ ~~ withOptions()~~ ] ( #withoptions )
64- * [ ~~ withoutBase()~~ ] ( #withoutbase )
6561 * [ React\Http\Middleware] ( #reacthttpmiddleware )
6662 * [ StreamingRequestMiddleware] ( #streamingrequestmiddleware )
6763 * [ LimitConcurrentRequestsMiddleware] ( #limitconcurrentrequestsmiddleware )
6864 * [ RequestBodyBufferMiddleware] ( #requestbodybuffermiddleware )
6965 * [ RequestBodyParserMiddleware] ( #requestbodyparsermiddleware )
7066 * [ ResponseInterface] ( #responseinterface )
7167 * [ RequestInterface] ( #requestinterface )
72- * [ UriInterface] ( #uriinterface )
7368 * [ ResponseException] ( #responseexception )
7469* [ Install] ( #install )
7570* [ Tests] ( #tests )
@@ -118,8 +113,6 @@ See also the [examples](examples).
118113
119114### Request methods
120115
121- <a id =" methods " ></a ><!-- legacy fragment id -->
122-
123116Most importantly, this project provides a [ ` Browser ` ] ( #browser ) object that
124117offers several methods that resemble the HTTP protocol methods:
125118
@@ -450,8 +443,6 @@ more details.
450443
451444### Streaming response
452445
453- <a id =" streaming " ></a ><!-- legacy fragment id -->
454-
455446All of the above examples assume you want to store the whole response body in memory.
456447This is easy to get started and works reasonably well for smaller responses.
457448
@@ -558,10 +549,6 @@ $stream->on('data', function ($data) {
558549
559550See also the [ ` requestStreaming() ` ] ( #requeststreaming ) method for more details.
560551
561- > Legacy info: Legacy versions prior to v2.9.0 used the legacy
562- [ ` streaming ` option] ( #withoptions ) . This option is now deprecated but otherwise
563- continues to show the exact same behavior.
564-
565552### Streaming request
566553
567554Besides streaming the response body, you can also stream the request body.
@@ -1105,8 +1092,6 @@ header or when using `Transfer-Encoding: chunked` for HTTP/1.1 requests.
11051092
11061093#### Streaming incoming request
11071094
1108- <a id =" streaming-request " ></a ><!-- legacy fragment id -->
1109-
11101095If you're using the advanced [ ` StreamingRequestMiddleware ` ] ( #streamingrequestmiddleware ) ,
11111096the request object will be processed once the request headers have been received.
11121097This means that this happens irrespective of (i.e. * before* ) receiving the
@@ -1413,8 +1398,6 @@ If a promise is resolved after the client closes, it will simply be ignored.
14131398
14141399#### Streaming outgoing response
14151400
1416- <a id =" streaming-response " ></a ><!-- legacy fragment id -->
1417-
14181401The ` Response ` class in this project supports to add an instance which implements the
14191402[ ReactPHP ReadableStreamInterface] ( https://github.com/reactphp/stream#readablestreaminterface )
14201403for the response body.
@@ -1859,7 +1842,7 @@ $browser = new React\Http\Browser($loop, $connector);
18591842
18601843#### get()
18611844
1862- The ` get(string|UriInterface $url, array $headers = array()): PromiseInterface<ResponseInterface> ` method can be used to
1845+ The ` get(string $url, array $headers = array()): PromiseInterface<ResponseInterface> ` method can be used to
18631846send an HTTP GET request.
18641847
18651848``` php
@@ -1870,13 +1853,9 @@ $browser->get($url)->then(function (Psr\Http\Message\ResponseInterface $response
18701853
18711854See also [ example 01] ( examples/01-google.php ) .
18721855
1873- > For BC reasons, this method accepts the ` $url ` as either a ` string `
1874- value or as an ` UriInterface ` . It's recommended to explicitly cast any
1875- objects implementing ` UriInterface ` to ` string ` .
1876-
18771856#### post()
18781857
1879- The ` post(string|UriInterface $url, array $headers = array(), string|ReadableStreamInterface $contents = ''): PromiseInterface<ResponseInterface> ` method can be used to
1858+ The ` post(string $url, array $headers = array(), string|ReadableStreamInterface $contents = ''): PromiseInterface<ResponseInterface> ` method can be used to
18801859send an HTTP POST request.
18811860
18821861``` php
@@ -1925,13 +1904,9 @@ $loop->addTimer(1.0, function () use ($body) {
19251904$browser->post($url, array('Content-Length' => '11'), $body);
19261905```
19271906
1928- > For BC reasons, this method accepts the ` $url ` as either a ` string `
1929- value or as an ` UriInterface ` . It's recommended to explicitly cast any
1930- objects implementing ` UriInterface ` to ` string ` .
1931-
19321907#### head()
19331908
1934- The ` head(string|UriInterface $url, array $headers = array()): PromiseInterface<ResponseInterface> ` method can be used to
1909+ The ` head(string $url, array $headers = array()): PromiseInterface<ResponseInterface> ` method can be used to
19351910send an HTTP HEAD request.
19361911
19371912``` php
@@ -1940,13 +1915,9 @@ $browser->head($url)->then(function (Psr\Http\Message\ResponseInterface $respons
19401915});
19411916```
19421917
1943- > For BC reasons, this method accepts the ` $url ` as either a ` string `
1944- value or as an ` UriInterface ` . It's recommended to explicitly cast any
1945- objects implementing ` UriInterface ` to ` string ` .
1946-
19471918#### patch()
19481919
1949- The ` patch(string|UriInterface $url, array $headers = array(), string|ReadableStreamInterface $contents = ''): PromiseInterface<ResponseInterface> ` method can be used to
1920+ The ` patch(string $url, array $headers = array(), string|ReadableStreamInterface $contents = ''): PromiseInterface<ResponseInterface> ` method can be used to
19501921send an HTTP PATCH request.
19511922
19521923``` php
@@ -1976,13 +1947,9 @@ $loop->addTimer(1.0, function () use ($body) {
19761947$browser->patch($url, array('Content-Length' => '11'), $body);
19771948```
19781949
1979- > For BC reasons, this method accepts the ` $url ` as either a ` string `
1980- value or as an ` UriInterface ` . It's recommended to explicitly cast any
1981- objects implementing ` UriInterface ` to ` string ` .
1982-
19831950#### put()
19841951
1985- The ` put(string|UriInterface $url, array $headers = array()): PromiseInterface<ResponseInterface> ` method can be used to
1952+ The ` put(string $url, array $headers = array()): PromiseInterface<ResponseInterface> ` method can be used to
19861953send an HTTP PUT request.
19871954
19881955``` php
@@ -2014,13 +1981,9 @@ $loop->addTimer(1.0, function () use ($body) {
20141981$browser->put($url, array('Content-Length' => '11'), $body);
20151982```
20161983
2017- > For BC reasons, this method accepts the ` $url ` as either a ` string `
2018- value or as an ` UriInterface ` . It's recommended to explicitly cast any
2019- objects implementing ` UriInterface ` to ` string ` .
2020-
20211984#### delete()
20221985
2023- The ` delete(string|UriInterface $url, array $headers = array()): PromiseInterface<ResponseInterface> ` method can be used to
1986+ The ` delete(string $url, array $headers = array()): PromiseInterface<ResponseInterface> ` method can be used to
20241987send an HTTP DELETE request.
20251988
20261989``` php
@@ -2029,10 +1992,6 @@ $browser->delete($url)->then(function (Psr\Http\Message\ResponseInterface $respo
20291992});
20301993```
20311994
2032- > For BC reasons, this method accepts the ` $url ` as either a ` string `
2033- value or as an ` UriInterface ` . It's recommended to explicitly cast any
2034- objects implementing ` UriInterface ` to ` string ` .
2035-
20361995#### request()
20371996
20381997The ` request(string $method, string $url, array $headers = array(), string|ReadableStreamInterface $body = ''): PromiseInterface<ResponseInterface> ` method can be used to
@@ -2070,12 +2029,6 @@ $loop->addTimer(1.0, function () use ($body) {
20702029$browser->request('POST', $url, array('Content-Length' => '11'), $body);
20712030```
20722031
2073- > Note that this method is available as of v2.9.0 and always buffers the
2074- response body before resolving.
2075- It does not respect the deprecated [ ` streaming ` option] ( #withoptions ) .
2076- If you want to stream the response body, you can use the
2077- [ ` requestStreaming() ` ] ( #requeststreaming ) method instead.
2078-
20792032#### requestStreaming()
20802033
20812034The ` requestStreaming(string $method, string $url, array $headers = array(), string|ReadableStreamInterface $body = ''): PromiseInterface<ResponseInterface> ` method can be used to
@@ -2138,55 +2091,6 @@ $loop->addTimer(1.0, function () use ($body) {
21382091$browser->requestStreaming('POST', $url, array('Content-Length' => '11'), $body);
21392092```
21402093
2141- > Note that this method is available as of v2.9.0 and always resolves the
2142- response without buffering the response body.
2143- It does not respect the deprecated [ ` streaming ` option] ( #withoptions ) .
2144- If you want to buffer the response body, use can use the
2145- [ ` request() ` ] ( #request ) method instead.
2146-
2147- #### ~~ submit()~~
2148-
2149- > Deprecated since v2.9.0, see [ ` post() ` ] ( #post ) instead.
2150-
2151- The deprecated ` submit(string|UriInterface $url, array $fields, array $headers = array(), string $method = 'POST'): PromiseInterface<ResponseInterface> ` method can be used to
2152- submit an array of field values similar to submitting a form (` application/x-www-form-urlencoded ` ).
2153-
2154- ``` php
2155- // deprecated: see post() instead
2156- $browser->submit($url, array('user' => 'test', 'password' => 'secret'));
2157- ```
2158-
2159- > For BC reasons, this method accepts the ` $url ` as either a ` string `
2160- value or as an ` UriInterface ` . It's recommended to explicitly cast any
2161- objects implementing ` UriInterface ` to ` string ` .
2162-
2163- #### ~~ send()~~
2164-
2165- > Deprecated since v2.9.0, see [ ` request() ` ] ( #request ) instead.
2166-
2167- The deprecated ` send(RequestInterface $request): PromiseInterface<ResponseInterface> ` method can be used to
2168- send an arbitrary instance implementing the [ ` RequestInterface ` ] ( #requestinterface ) (PSR-7).
2169-
2170- The preferred way to send an HTTP request is by using the above
2171- [ request methods] ( #request-methods ) , for example the [ ` get() ` ] ( #get )
2172- method to send an HTTP ` GET ` request.
2173-
2174- As an alternative, if you want to use a custom HTTP request method, you
2175- can use this method:
2176-
2177- ``` php
2178- $request = new Request('OPTIONS', $url);
2179-
2180- // deprecated: see request() instead
2181- $browser->send($request)->then(…);
2182- ```
2183-
2184- This method will automatically add a matching ` Content-Length ` request
2185- header if the size of the outgoing request body is known and non-empty.
2186- For an empty request body, if will only include a ` Content-Length: 0 `
2187- request header if the request method usually expects a request body (only
2188- applies to ` POST ` , ` PUT ` and ` PATCH ` ).
2189-
21902094#### withTimeout()
21912095
21922096The ` withTimeout(bool|number $timeout): Browser ` method can be used to
@@ -2313,7 +2217,7 @@ given setting applied.
23132217
23142218#### withBase()
23152219
2316- The ` withBase(string|null|UriInterface $baseUrl): Browser ` method can be used to
2220+ The ` withBase(string|null $baseUrl): Browser ` method can be used to
23172221change the base URL used to resolve relative URLs to.
23182222
23192223If you configure a base URL, any requests to relative URLs will be
@@ -2346,14 +2250,6 @@ This method will throw an `InvalidArgumentException` if the given
23462250Notice that the [ ` Browser ` ] ( #browser ) is an immutable object, i.e. the ` withBase() ` method
23472251actually returns a * new* [ ` Browser ` ] ( #browser ) instance with the given base URL applied.
23482252
2349- > For BC reasons, this method accepts the ` $baseUrl ` as either a ` string `
2350- value or as an ` UriInterface ` . It's recommended to explicitly cast any
2351- objects implementing ` UriInterface ` to ` string ` .
2352-
2353- > Changelog: As of v2.9.0 this method accepts a ` null ` value to reset the
2354- base URL. Earlier versions had to use the deprecated ` withoutBase() `
2355- method to reset the base URL.
2356-
23572253#### withProtocolVersion()
23582254
23592255The ` withProtocolVersion(string $protocolVersion): Browser ` method can be used to
@@ -2415,54 +2311,6 @@ Notice that the [`Browser`](#browser) is an immutable object, i.e. this
24152311method actually returns a * new* [ ` Browser ` ] ( #browser ) instance with the
24162312given setting applied.
24172313
2418- #### ~~ withOptions()~~
2419-
2420- > Deprecated since v2.9.0, see [ ` withTimeout() ` ] ( #withtimeout ) , [ ` withFollowRedirects() ` ] ( #withfollowredirects )
2421- and [ ` withRejectErrorResponse() ` ] ( #withrejecterrorresponse ) instead.
2422-
2423- The deprecated ` withOptions(array $options): Browser ` method can be used to
2424- change the options to use:
2425-
2426- The [ ` Browser ` ] ( #browser ) class exposes several options for the handling of
2427- HTTP transactions. These options resemble some of PHP's
2428- [ HTTP context options] ( https://www.php.net/manual/en/context.http.php ) and
2429- can be controlled via the following API (and their defaults):
2430-
2431- ``` php
2432- // deprecated
2433- $newBrowser = $browser->withOptions(array(
2434- 'timeout' => null, // see withTimeout() instead
2435- 'followRedirects' => true, // see withFollowRedirects() instead
2436- 'maxRedirects' => 10, // see withFollowRedirects() instead
2437- 'obeySuccessCode' => true, // see withRejectErrorResponse() instead
2438- 'streaming' => false, // deprecated, see requestStreaming() instead
2439- ));
2440- ```
2441-
2442- See also [ timeouts] ( #timeouts ) , [ redirects] ( #redirects ) and
2443- [ streaming] ( #streaming-response ) for more details.
2444-
2445- Notice that the [ ` Browser ` ] ( #browser ) is an immutable object, i.e. this
2446- method actually returns a * new* [ ` Browser ` ] ( #browser ) instance with the
2447- options applied.
2448-
2449- #### ~~ withoutBase()~~
2450-
2451- > Deprecated since v2.9.0, see [ ` withBase() ` ] ( #withbase ) instead.
2452-
2453- The deprecated ` withoutBase(): Browser ` method can be used to
2454- remove the base URL.
2455-
2456- ``` php
2457- // deprecated: see withBase() instead
2458- $newBrowser = $browser->withoutBase();
2459- ```
2460-
2461- Notice that the [ ` Browser ` ] ( #browser ) is an immutable object, i.e. the ` withoutBase() ` method
2462- actually returns a * new* [ ` Browser ` ] ( #browser ) instance without any base URL applied.
2463-
2464- See also [ ` withBase() ` ] ( #withbase ) .
2465-
24662314### React\Http\Middleware
24672315
24682316#### StreamingRequestMiddleware
@@ -2769,18 +2617,6 @@ This is a standard interface defined in
27692617which in turn extends the
27702618[ ` MessageInterface ` definition] ( https://www.php-fig.org/psr/psr-7/#3-1-psr-http-message-messageinterface ) .
27712619
2772- ### UriInterface
2773-
2774- The ` Psr\Http\Message\UriInterface ` represents an absolute or relative URI (aka URL).
2775-
2776- This is a standard interface defined in
2777- [ PSR-7: HTTP message interfaces] ( https://www.php-fig.org/psr/psr-7/ ) , see its
2778- [ ` UriInterface ` definition] ( https://www.php-fig.org/psr/psr-7/#3-5-psr-http-message-uriinterface ) .
2779-
2780- > For BC reasons, the request methods accept the URL as either a ` string `
2781- value or as an ` UriInterface ` . It's recommended to explicitly cast any
2782- objects implementing ` UriInterface ` to ` string ` .
2783-
27842620### ResponseException
27852621
27862622The ` ResponseException ` is an ` Exception ` sub-class that will be used to reject
0 commit comments