PHP code example of friendsofhyperf / async-task

1. Go to this page and download the library: Download friendsofhyperf/async-task library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

friendsofhyperf / async-task example snippets


use FriendsOfHyperf\AsyncTask\AbstractTask;
use FriendsOfHyperf\AsyncTask\Task;

class FooTask extends AbstractTask
{
    public function handle():void
    {
        var_dump('foo');
    }
}

Task::deliver(new FooTask());

Task::deliver(fn () => var_dump(111));