PHP code example of nikita2206 / poller

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

    

nikita2206 / poller example snippets

 php
$poller = new Poller($tasksQueue, 3);
 php
$poller->run();
 php
$poller->attachListener(Poller::EVENT_TASK_STARTED_PRE, function ($eventName, NamedTask $task) {
    echo "Task ", $task->getName(), " is gonna be started!", "\n";
});

$poller->attachListener(Poller::EVENT_TASK_FINISHED, function ($eventName, NamedTask $task) {
    echo "Task ", $task->getName(), " was finished!", "\n";
});