From b8d4472ff90be824b97896a23875fa2a4b57d731 Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Tue, 13 Oct 2020 11:25:53 +0200 Subject: [PATCH] Update to reactphp/http v1.0.0 --- README.md | 16 ++++++++-------- composer.json | 4 ++-- examples/01-transform.php | 2 +- examples/02-transform-all.php | 2 +- examples/03-transform-any.php | 2 +- src/Transformer.php | 14 +++++++------- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 1d80c50..e21e5d0 100644 --- a/README.md +++ b/README.md @@ -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; @@ -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); ``` @@ -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); @@ -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); @@ -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)); @@ -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)); diff --git a/composer.json b/composer.json index 051be5f..f7d6f11 100644 --- a/composer.json +++ b/composer.json @@ -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" } } diff --git a/examples/01-transform.php b/examples/01-transform.php index e11c435..bf4e2c0 100644 --- a/examples/01-transform.php +++ b/examples/01-transform.php @@ -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; diff --git a/examples/02-transform-all.php b/examples/02-transform-all.php index 8726967..610470a 100644 --- a/examples/02-transform-all.php +++ b/examples/02-transform-all.php @@ -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'; diff --git a/examples/03-transform-any.php b/examples/03-transform-any.php index ea2e8cf..973cbbb 100644 --- a/examples/03-transform-any.php +++ b/examples/03-transform-any.php @@ -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'; diff --git a/src/Transformer.php b/src/Transformer.php index 2f192dd..6622b81 100644 --- a/src/Transformer.php +++ b/src/Transformer.php @@ -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); * ``` @@ -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); @@ -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); @@ -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)); @@ -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));