PHP code example of nekudo / angela

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

    

nekudo / angela example snippets




class WorkerA extends \Nekudo\Angela\Worker
{
    public function taskA(string $payload) : string
    {
        // Do some work:
        sleep(1);

        // Return a response (needs to be string!):
        return strrev($payload);
    }
}

// Create new worker and register jobs:
$worker = new WorkerA;
$worker->registerJob('taskA', [$worker, 'taskA']);
$worker->run();


$client = new \Nekudo\Angela\Client;
$client->addServer('tcp://127.0.0.1:5551');
$result = $client->doNormal('taskA', 'some payload'); // result is "daolyap emos"
$client->close();