Skip to content

Commit 125e89b

Browse files
committed
Update example to new eventloop API
1 parent c4ca735 commit 125e89b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@ Once [installed](#install), you can use the following code to decorate a demo
1515
function and avoid sending unneeded HTTP requests:
1616

1717
```php
18-
$browser = new React\Http\Browser($loop);
18+
<?php
19+
20+
require __DIR__ . '/vendor/autoload.php';
21+
22+
$browser = new React\Http\Browser();
1923

2024
$fetch = function (int $id) use ($browser) {
2125
return $browser->get('http://httpbingo.org/status/' . $id)->then(function (ResponseInterface $response) {
2226
return $response->getStatusCode();
27+
}, function (Exception $e) {
28+
echo 'Error: ' . $e->getMessage() . PHP_EOL;
2329
});
2430
}
2531

0 commit comments

Comments
 (0)