Skip to content

Commit

Permalink
Supplement the missing parts of runnable code (#450)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwlwilliam authored Jan 25, 2025
1 parent 7a72295 commit 94e3525
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ Callbacks registered on the Revolt event-loop are automatically run as coroutine
```php
<?php

use function Amp\delay;

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

use function Amp\delay;

Amp\async(function () {
print '++ Executing callback passed to async()' . PHP_EOL;

Expand Down Expand Up @@ -195,6 +195,8 @@ retrieve multiple HTTP resources concurrently:
```php
<?php

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

use Amp\Future;
use Amp\Http\Client\HttpClientBuilder;
use Amp\Http\Client\Request;
Expand Down Expand Up @@ -284,6 +286,9 @@ associated `Future` to its caller.
```php
<?php // Example async producer using DeferredFuture

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

use Amp\Future;
use Revolt\EventLoop;

function asyncMultiply(int $x, int $y): Future
Expand Down

0 comments on commit 94e3525

Please sign in to comment.