@@ -65,19 +65,23 @@ Once [installed](#install), you can use the following code to access an
65
65
HTTP webserver and send a large number of HTTP GET requests:
66
66
67
67
``` php
68
+ <?php
69
+
70
+ require __DIR__ . '/vendor/autoload.php';
71
+
68
72
$browser = new React\Http\Browser();
69
73
70
74
// load a huge array of URLs to fetch
71
75
$urls = file('urls.txt');
72
76
73
77
// each job should use the browser to GET a certain URL
74
78
// 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) {
76
80
return $browser->get($url);
77
81
});
78
82
79
83
foreach ($urls as $url) {
80
- $q($url)->then(function (ResponseInterface $response) use ($url) {
84
+ $q($url)->then(function (Psr\Http\Message\ ResponseInterface $response) use ($url) {
81
85
echo $url . ': ' . $response->getBody()->getSize() . ' bytes' . PHP_EOL;
82
86
});
83
87
}
@@ -473,7 +477,7 @@ for more details.
473
477
474
478
## Install
475
479
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/ ) .
477
481
[ New to Composer?] ( https://getcomposer.org/doc/00-intro.md )
478
482
479
483
This project follows [ SemVer] ( https://semver.org/ ) .
@@ -487,12 +491,12 @@ See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.
487
491
488
492
This project aims to run on any platform and thus does not require any PHP
489
493
extensions 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.
491
495
492
496
## Tests
493
497
494
498
To 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/ ) :
496
500
497
501
``` bash
498
502
$ composer install
@@ -501,7 +505,7 @@ $ composer install
501
505
To run the test suite, go to the project root and run:
502
506
503
507
``` bash
504
- $ php vendor/bin/phpunit
508
+ $ vendor/bin/phpunit
505
509
```
506
510
507
511
## License
0 commit comments