PHP worker/microservice framework based on ZeroMQ.

v2.0.0 2017-01-08 15:29 UTC

This package is not auto-updated.

Last update: 2022-05-14 05:48:52 UTC


Angela is a PHP worker/microservice framework based on ZeroMQ.

A typical Angela application consists of a job-server, a client to communicate with the server and workers which do the actual jobs. Angela provides the job server, the client and an API so you can easily implement your worker processes.

             | Client |
           | Job Server |
     +-------^   ^    ^------+
     |           |           |
     |           |           |
     v           v           v
+--------+   +--------+   +--------+
| Worker |   | Worker |   | Worker |
+--------+   +--------+   +--------+


Job server

The job server is Angelas main process. It manages all your workers, listens for new job-requests, distributes these jobs to your workers and send back responses to the client. One server can manage multiple pools of workers and hence handle various types of jobs.

The job server will fire up worker-processes as defined in your project configuration. It will monitor the workers and for example restart processes if a worker crashes.

It is also capable of basic load-balancing so jobs will always be passed to the next idle worker.


Angela provides an API to easily build worker processes. Each worker typically does one kind of job (even though in can handle multiple types). You would than start multiple pools of worker processes which handle the different kind of jobs required in your application.



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

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

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


The client is a simple class which allows you to send commands or job-requests to the server. It can send commands, normal jobs or background-jobs.

Normal jobs are blocking as the client will wait for a response. Background jobs however are non-blocking. They will be processed by the server but the client does not wait for a response.


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



Using composer:

composer require nekudo/angela


Please see "example" folder for a dummy application. These are the most important files and commands:

  • config.php: Holds all necessary configuration for the server and worker pools.
  • control.php: A simple control-script to start/stop/restart your server and worker processes. Available commands are:
    • php control.php start
    • php control.php stop
    • php control.php restart
    • php control.php status
    • php control.php kill
    • php control.php flush-queue
  • client.php: An example client sending jobs to the job server.
  • worker/*.php: All your worker-scripts handling the actual jobs.


Released under the terms of the MIT license. See LICENSE file for details.