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 #24

Merged
merged 1 commit into from
Jul 30, 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
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ HTTP webserver and send a large number of HTTP GET requests:

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

// load a huge array of URLs to fetch
$urls = file('urls.txt');
Expand Down Expand Up @@ -143,13 +143,13 @@ $q = new Queue(10, null, array($browser, 'get'));
This library works under the assumption that you want to concurrently handle
async operations that use a [Promise](https://github.com/reactphp/promise)-based API.

The demonstration purposes, the examples in this documentation use the async
HTTP client [clue/reactphp-buzz](https://github.com/clue/reactphp-buzz), but you
The demonstration purposes, the examples in this documentation use
[ReactPHP's async HTTP client](https://github.com/reactphp/http#client-usage), but you
may use any Promise-based API with this project. 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 @@ -159,7 +159,7 @@ like this:

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

$q = new Queue(10, null, function ($url) use ($browser) {
return $browser->get($url);
Expand Down Expand Up @@ -270,7 +270,7 @@ resolves with the results of all jobs on success.

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

$promise = Queue::all(3, $urls, function ($url) use ($browser) {
return $browser->get($url);
Expand Down Expand Up @@ -347,7 +347,7 @@ to `cancel()` all outstanding jobs.

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

$promise = Queue::any(3, $urls, function ($url) use ($browser) {
return $browser->get($url);
Expand Down Expand Up @@ -421,7 +421,7 @@ could look something like this:
use Clue\React\Block;

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

$promise = Queue::all(3, $urls, function ($url) use ($browser) {
return $browser->get($url);
Expand Down Expand Up @@ -449,7 +449,7 @@ all the async details from the outside:
function download(array $uris)
{
$loop = React\EventLoop\Factory::create();
$browser = new Clue\React\Buzz\Browser($loop);
$browser = new React\Http\Browser($loop);

$promise = Queue::all(3, $uris, function ($uri) use ($browser) {
return $browser->get($uri);
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
},
"require-dev": {
"clue/block-react": "^1.0",
"clue/buzz-react": "^2.4",
"phpunit/phpunit": "^9.0 || ^5.7 || ^4.8.35",
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3"
"react/event-loop": "^1.0 || ^0.5",
"react/http": "^1.0"
}
}
2 changes: 1 addition & 1 deletion examples/01-http.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

use Clue\React\Buzz\Browser;
use Clue\React\Mq\Queue;
use Psr\Http\Message\ResponseInterface;
use React\EventLoop\Factory;
use React\Http\Browser;

require __DIR__ . '/../vendor/autoload.php';

Expand Down
2 changes: 1 addition & 1 deletion examples/02-http-all.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

use Clue\React\Buzz\Browser;
use Clue\React\Mq\Queue;
use Psr\Http\Message\ResponseInterface;
use React\EventLoop\Factory;
use React\Http\Browser;

require __DIR__ . '/../vendor/autoload.php';

Expand Down
2 changes: 1 addition & 1 deletion examples/03-http-any.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

use Clue\React\Buzz\Browser;
use Clue\React\Mq\Queue;
use Psr\Http\Message\ResponseInterface;
use React\EventLoop\Factory;
use React\Http\Browser;

require __DIR__ . '/../vendor/autoload.php';

Expand Down
2 changes: 1 addition & 1 deletion examples/11-http-blocking.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

use Clue\React\Block;
use Clue\React\Buzz\Browser;
use Clue\React\Mq\Queue;
use Psr\Http\Message\ResponseInterface;
use React\EventLoop\Factory;
use React\Http\Browser;

require __DIR__ . '/../vendor/autoload.php';

Expand Down
4 changes: 2 additions & 2 deletions src/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Queue implements \Countable
*
* ```php
* $loop = React\EventLoop\Factory::create();
* $browser = new Clue\React\Buzz\Browser($loop);
* $browser = new React\Http\Browser($loop);
*
* $promise = Queue::all(3, $urls, function ($url) use ($browser) {
* return $browser->get($url);
Expand Down Expand Up @@ -155,7 +155,7 @@ public static function all($concurrency, array $jobs, $handler)
*
* ```php
* $loop = React\EventLoop\Factory::create();
* $browser = new Clue\React\Buzz\Browser($loop);
* $browser = new React\Http\Browser($loop);
*
* $promise = Queue::any(3, $urls, function ($url) use ($browser) {
* return $browser->get($url);
Expand Down