@@ -65,19 +65,23 @@ Once [installed](#install), you can use the following code to access an
6565HTTP webserver and send a large number of HTTP GET requests:
6666
6767``` php
68+ <?php
69+
70+ require __DIR__ . '/vendor/autoload.php';
71+
6872$browser = new React\Http\Browser();
6973
7074// load a huge array of URLs to fetch
7175$urls = file('urls.txt');
7276
7377// each job should use the browser to GET a certain URL
7478// limit number of concurrent jobs here
75- $q = new Queue(3, null, function ($url) use ($browser) {
79+ $q = new Clue\React\Mq\ Queue(3, null, function ($url) use ($browser) {
7680 return $browser->get($url);
7781});
7882
7983foreach ($urls as $url) {
80- $q($url)->then(function (ResponseInterface $response) use ($url) {
84+ $q($url)->then(function (Psr\Http\Message\ ResponseInterface $response) use ($url) {
8185 echo $url . ': ' . $response->getBody()->getSize() . ' bytes' . PHP_EOL;
8286 });
8387}
@@ -473,7 +477,7 @@ for more details.
473477
474478## Install
475479
476- The recommended way to install this library is [ through Composer] ( https://getcomposer.org ) .
480+ The recommended way to install this library is [ through Composer] ( https://getcomposer.org/ ) .
477481[ New to Composer?] ( https://getcomposer.org/doc/00-intro.md )
478482
479483This project follows [ SemVer] ( https://semver.org/ ) .
@@ -487,12 +491,12 @@ See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.
487491
488492This project aims to run on any platform and thus does not require any PHP
489493extensions and supports running on legacy PHP 5.3 through current PHP 8+.
490- It's * highly recommended to use PHP 7+ * for this project.
494+ It's highly recommended to use the latest supported PHP version for this project.
491495
492496## Tests
493497
494498To run the test suite, you first need to clone this repo and then install all
495- dependencies [ through Composer] ( https://getcomposer.org ) :
499+ dependencies [ through Composer] ( https://getcomposer.org/ ) :
496500
497501``` bash
498502$ composer install
@@ -501,7 +505,7 @@ $ composer install
501505To run the test suite, go to the project root and run:
502506
503507``` bash
504- $ php vendor/bin/phpunit
508+ $ vendor/bin/phpunit
505509```
506510
507511## License
0 commit comments