Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deprecation notice to suggest HTTP component instead #153

Merged
merged 1 commit into from
Sep 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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