PHP code example of madnh / task_waiter

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

    

madnh / task_waiter example snippets


use MaDnh\TaskWaiter\TaskWaiter as Task;

echo "Start example\n";
$task = 'example_task';

//Task::$savePath = __DIR__;

echo Task::isWorking($task) ? "Task is running in other process" : 'Task is free';

print "\n";

if (Task::start($task)) {
    echo "Task is in processing!\n";

    sleep(5);
    Task::complete($task);

    echo "Task complete!\n";
    echo "Do other process!\n";

    sleep(5);
} else {
    echo "Start failed";
}

echo "Bye!";