PHP code example of tasque / event-loop

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

    

tasque / event-loop example snippets




declare(strict_types=1);

use Nytris\Boot\BootConfig;
use Nytris\Boot\PlatformConfig;
use Tasque\EventLoop\TasqueEventLoopPackage;
use Tasque\TasquePackage;

$bootConfig = new BootConfig(new PlatformConfig(__DIR__ . '/var/cache/nytris/'));

$bootConfig->installPackage(new TasquePackage());
$bootConfig->installPackage(new TasqueEventLoopPackage());

return $bootConfig;



declare(strict_types=1);

use React\EventLoop\Loop;

lapsed' . PHP_EOL;
});



declare(strict_types=1);

use Tasque\EventLoop\TasqueEventLoop;

/*
 * This will cause the current thread (which may be the main thread
 * as well as a background thread) to pause until the promise is resolved,
 * in which case the result will be returned, or rejected, in which case
 * the reason will be thrown.
 */
$result = TasqueEventLoop::await($promise);