Skip to content

Commit

Permalink
Merge pull request #153 from clue-labs/deprecation
Browse files Browse the repository at this point in the history
Add deprecation notice to suggest HTTP component instead
  • Loading branch information
jsor authored Sep 27, 2020
2 parents f16ab55 + fc3e5d0 commit 7d02e82
Showing 1 changed file with 40 additions and 8 deletions.
48 changes: 40 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,48 @@
# HttpClient
# Deprecation notice

This package has now been migrated over to
[react/http](https://github.com/reactphp/http)
and only exists for BC reasons.

```bash
$ composer require react/http
```

If you've previously used this package, upgrading may take a moment or two.
The new API has been updated to use Promises and PSR-7 message abstractions.
This means it's now more powerful and easier to use than ever:

```php
// old
$client = new React\HttpClient\Client($loop);
$request = $client->request('GET', 'https://example.com/');
$request->on('response', function ($response) {
$response->on('data', function ($chunk) {
echo $chunk;
});
});
$request->end();

// new
$browser = new React\Http\Browser($loop);
$browser->get('https://example.com/')->then(function (Psr\Http\Message\ResponseInterface $response) {
echo $response->getBody();
});
```

See [react/http](https://github.com/reactphp/http#client-usage) for more details.

The below documentation applies to the last release of this package.
Further development will take place in the updated
[react/http](https://github.com/reactphp/http),
so you're highly recommended to upgrade as soon as possible.

# Deprecated HttpClient

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

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

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

**Table of Contents**

* [Basic usage](#basic-usage)
Expand Down

0 comments on commit 7d02e82

Please sign in to comment.