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

Update to reactphp/http v1.0.0 #20

Merged
merged 1 commit into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
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
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ user lists by sending a (RESTful) HTTP API request for each user record:

```php
$loop = React\EventLoop\Factory::create();
$browser = new Clue\React\Buzz\Browser($loop);
$browser = new React\Http\Browser($loop);

$concurrency = isset($argv[1]) ? $argv[1] : 3;

Expand Down Expand Up @@ -182,13 +182,13 @@ async operations that use a [Promise](https://github.com/reactphp/promise)-based
You can use this to concurrently run multiple HTTP requests, database queries
or pretty much any API that already uses Promises.

The demonstration purposes, the examples in this documentation use the async
HTTP client [clue/reactphp-buzz](https://github.com/clue/reactphp-buzz).
For demonstration purposes, the examples in this documentation use
[ReactPHP's async HTTP client](https://github.com/reactphp/http#client-usage).
Its API can be used like this:

```php
$loop = React\EventLoop\Factory::create();
$browser = new Clue\React\Buzz\Browser($loop);
$browser = new React\Http\Browser($loop);

$promise = $browser->get($url);
```
Expand All @@ -198,7 +198,7 @@ like this:

```php
$loop = React\EventLoop\Factory::create();
$browser = new Clue\React\Buzz\Browser($loop);
$browser = new React\Http\Browser($loop);

$transformer = new Transformer(10, function ($url) use ($browser) {
return $browser->get($url);
Expand Down Expand Up @@ -313,7 +313,7 @@ given above:

```php
$loop = React\EventLoop\Factory::create();
$browser = new Clue\React\Buzz\Browser($loop);
$browser = new React\Http\Browser($loop);

$transformer = new Transformer(10, function ($url) use ($browser) {
return $browser->get($url);
Expand Down Expand Up @@ -440,7 +440,7 @@ on success.

```php
$loop = React\EventLoop\Factory::create();
$browser = new Clue\React\Buzz\Browser($loop);
$browser = new React\Http\Browser($loop);

$promise = Transformer::all($input, 3, function ($data) use ($browser, $url) {
return $browser->post($url, [], json_encode($data));
Expand Down Expand Up @@ -546,7 +546,7 @@ success.

```php
$loop = React\EventLoop\Factory::create();
$browser = new Clue\React\Buzz\Browser($loop);
$browser = new React\Http\Browser($loop);

$promise = Transformer::any($input, 3, function ($data) use ($browser, $url) {
return $browser->post($url, [], json_encode($data));
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"react/stream": "^1.0 || ^0.7.7"
},
"require-dev": {
"clue/buzz-react": "^2.4",
"clue/ndjson-react": "^1.0",
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35"
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35",
"react/http": "^1.0"
}
}
2 changes: 1 addition & 1 deletion examples/01-transform.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
require __DIR__ . '/../vendor/autoload.php';

$loop = React\EventLoop\Factory::create();
$browser = new Clue\React\Buzz\Browser($loop);
$browser = new React\Http\Browser($loop);

$concurrency = isset($argv[1]) ? $argv[1] : 3;

Expand Down
2 changes: 1 addition & 1 deletion examples/02-transform-all.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
require __DIR__ . '/../vendor/autoload.php';

$loop = React\EventLoop\Factory::create();
$browser = new Clue\React\Buzz\Browser($loop);
$browser = new React\Http\Browser($loop);

$concurrency = isset($argv[1]) ? $argv[1] : 3;
$url = isset($argv[2]) ? $argv[2] : 'http://httpbin.org/post';
Expand Down
2 changes: 1 addition & 1 deletion examples/03-transform-any.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
require __DIR__ . '/../vendor/autoload.php';

$loop = React\EventLoop\Factory::create();
$browser = new Clue\React\Buzz\Browser($loop);
$browser = new React\Http\Browser($loop);

$concurrency = isset($argv[1]) ? $argv[1] : 3;
$url = isset($argv[2]) ? $argv[2] : 'http://httpbin.org/post';
Expand Down
14 changes: 7 additions & 7 deletions src/Transformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
* You can use this to concurrently run multiple HTTP requests, database queries
* or pretty much any API that already uses Promises.
*
* The demonstration purposes, the examples in this documentation use the async
* HTTP client [clue/reactphp-buzz](https://github.com/clue/reactphp-buzz).
* For demonstration purposes, the examples in this documentation use
* [ReactPHP's async HTTP client](https://github.com/reactphp/http#client-usage).
* Its API can be used like this:
*
* ```php
* $loop = React\EventLoop\Factory::create();
* $browser = new Clue\React\Buzz\Browser($loop);
* $browser = new React\Http\Browser($loop);
*
* $promise = $browser->get($url);
* ```
Expand All @@ -56,7 +56,7 @@
*
* ```php
* $loop = React\EventLoop\Factory::create();
* $browser = new Clue\React\Buzz\Browser($loop);
* $browser = new React\Http\Browser($loop);
*
* $transformer = new Transformer(10, function ($url) use ($browser) {
* return $browser->get($url);
Expand Down Expand Up @@ -171,7 +171,7 @@
*
* ```php
* $loop = React\EventLoop\Factory::create();
* $browser = new Clue\React\Buzz\Browser($loop);
* $browser = new React\Http\Browser($loop);
*
* $transformer = new Transformer(10, function ($url) use ($browser) {
* return $browser->get($url);
Expand Down Expand Up @@ -311,7 +311,7 @@ final class Transformer extends EventEmitter implements DuplexStreamInterface
*
* ```php
* $loop = React\EventLoop\Factory::create();
* $browser = new Clue\React\Buzz\Browser($loop);
* $browser = new React\Http\Browser($loop);
*
* $promise = Transformer::all($input, 3, function ($data) use ($browser, $url) {
* return $browser->post($url, [], json_encode($data));
Expand Down Expand Up @@ -464,7 +464,7 @@ public static function all(ReadableStreamInterface $input, $concurrency, $callba
*
* ```php
* $loop = React\EventLoop\Factory::create();
* $browser = new Clue\React\Buzz\Browser($loop);
* $browser = new React\Http\Browser($loop);
*
* $promise = Transformer::any($input, 3, function ($data) use ($browser, $url) {
* return $browser->post($url, [], json_encode($data));
Expand Down