Skip to content

Commit

Permalink
Clarify autoload requirement in example
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Aug 30, 2023
1 parent 24e2b77 commit f54bb40
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ In the example below, a `Task` is defined which calls a blocking function (`file
Child processes or threads executing tasks may be reused to execute multiple tasks.

```php
// FetchTask.php
// Tasks must be defined in a file which can be loaded by the composer autoloader.

use Amp\Cancellation;
use Amp\Parallel\Worker\Task;
use Amp\Sync\Channel;
Expand All @@ -99,6 +102,8 @@ class FetchTask implements Task
```

```php
// main.php

$worker = Amp\Parallel\Worker\createWorker();
$task = new FetchTask('https://amphp.org');

Expand Down

0 comments on commit f54bb40

Please sign in to comment.