1. Go to this page and download the library: Download srdestino/waitable 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/ */
srdestino / waitable example snippets
php
$waitable = new Waitable(function (IWaitable $waitable){
LongTask();
$waitable->Resolve(null); // When you call this method it will mark the Waitable as Fulfilled
});
php
$waitable = new Waitable(function (IWaitable $waitable){
$waitable->Resolve("Test"); // When you call this method it will mark the waitable as Fulfilled
});
$result = $waitable->Wait();
echo $result; // It will print "Test"