Skip to content

Commit 7d02e82

Browse files
authored
Merge pull request #153 from clue-labs/deprecation
Add deprecation notice to suggest HTTP component instead
2 parents f16ab55 + fc3e5d0 commit 7d02e82

File tree

1 file changed

+40
-8
lines changed

1 file changed

+40
-8
lines changed

README.md

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,48 @@
1-
# HttpClient
1+
# Deprecation notice
2+
3+
This package has now been migrated over to
4+
[react/http](https://github.com/reactphp/http)
5+
and only exists for BC reasons.
6+
7+
```bash
8+
$ composer require react/http
9+
```
10+
11+
If you've previously used this package, upgrading may take a moment or two.
12+
The new API has been updated to use Promises and PSR-7 message abstractions.
13+
This means it's now more powerful and easier to use than ever:
14+
15+
```php
16+
// old
17+
$client = new React\HttpClient\Client($loop);
18+
$request = $client->request('GET', 'https://example.com/');
19+
$request->on('response', function ($response) {
20+
$response->on('data', function ($chunk) {
21+
echo $chunk;
22+
});
23+
});
24+
$request->end();
25+
26+
// new
27+
$browser = new React\Http\Browser($loop);
28+
$browser->get('https://example.com/')->then(function (Psr\Http\Message\ResponseInterface $response) {
29+
echo $response->getBody();
30+
});
31+
```
32+
33+
See [react/http](https://github.com/reactphp/http#client-usage) for more details.
34+
35+
The below documentation applies to the last release of this package.
36+
Further development will take place in the updated
37+
[react/http](https://github.com/reactphp/http),
38+
so you're highly recommended to upgrade as soon as possible.
39+
40+
# Deprecated HttpClient
241

342
[![Build Status](https://travis-ci.org/reactphp/http-client.svg?branch=master)](https://travis-ci.org/reactphp/http-client)
443

544
Event-driven, streaming HTTP client for [ReactPHP](https://reactphp.org).
645

7-
> Note that this is a very low-level HTTP client implementation that is currently
8-
undergoing some major changes. In the meantime, we recommend using
9-
[clue/reactphp-buzz](https://github.com/clue/reactphp-buzz) as a higher-level
10-
HTTP client abstraction (which happens to build on top of this project). It
11-
provides a Promise-based interface and common PSR-7 message abstraction which
12-
makes getting started much easier.
13-
1446
**Table of Contents**
1547

1648
* [Basic usage](#basic-usage)

0 commit comments

Comments
 (0)