PHP code example of innmind / async

1. Go to this page and download the library: Download innmind/async 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/ */

    

innmind / async example snippets


use Innmind\Async\{
    Scheduler,
    Scope\Continuation,
};
use Innmind\OperatingSystem\{
    OperatingSystem,
    Factory,
};
use Innmind\Immutable\Sequence;

Scheduler::of(Factory::build())
    ->sink(null)
    ->with(
        static fn(
            $_,
            OperatingSystem $os,
            Continuation $continuation,
        ) => $continuation
            ->schedule(Sequence::of(
                static fn(OperatingSystem $os) => importUsers($os),
                static fn(OperatingSystem $os) => importProducts($os),
            ))
            ->finish(),
    );