PHPackages                             crodas/worker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. crodas/worker

ActiveLibrary[Queues &amp; Workers](/categories/queues)

crodas/worker
=============

Generic class to queue and run tasks asynchronously

1341PHP

Since Oct 29Pushed 11y ago2 watchersCompare

[ Source](https://github.com/crodas/Worker)[ Packagist](https://packagist.org/packages/crodas/worker)[ RSS](/packages/crodas-worker/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Worker
======

[](#worker)

Queue-agnostic way of doing asynchronous jobs in PHP.

***This is a work in process, it isn't ready for production.***

Why?
----

[](#why)

To provide an easy way of running things in the backend in PHP. Anything that performs IO is a potential candidate for being run in the background. Sending emails, resize a picture, get the content of a website.

The idea behind this project is to provide a very easy interface to queue jobs/tasks.

*All tasks are runs asynchronously by design*

How?
----

[](#how)

It creates a lightweight manager PHP process, which is responsible for creating/checking/killing the "workers". The idea is to run the manager and forget about it.

The manager should scale/decrease the number of workers (up to a maximum).

The are two main classes, the `Client` and the `Server`.

```
require "vendor/autoload.php";

use crodas\Worker\Config;
use crodas\Worker\Server;

$config = new Config;
$config->setEngine("gearman")->addDirectory("my-tasks/");

new Server($config)->serve();
```

The `Server` is quite simple, and it is design so it can be run from the console terminal, never from a web server.

```
require "vendor/autoload.php";

use crodas\Worker\Config;
use crodas\Worker\Client;

$config = new Config;
$config->setEngine("gearman");

$client = new Client;

$client->push("do_something", ['arg1', 'arg2']);
$client->push("do_something", ['arg4', 'arg3']);
```

The `Client` is object is quite simple, they push tasks and forget about it. Notice that the `Config` object for the client doesn't have the `addDirectory()`, this is because a client doesn't need to know where the worker code are located.

Finally, defining workers are deadly simple. They need to be located in a directory where the server can reach them with `addDirectory()`. They need to be callable and that's all it takes.

```
/** @Worker("do_something") */
function foobar($args) {

}
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/36463?v=4)[C](/maintainers/crodas)[@crodas](https://github.com/crodas)

---

Top Contributors

[![crodas](https://avatars.githubusercontent.com/u/36463?v=4)](https://github.com/crodas "crodas (39 commits)")

### Embed Badge

![Health badge](/badges/crodas-worker/health.svg)

```
[![Health](https://phpackages.com/badges/crodas-worker/health.svg)](https://phpackages.com/packages/crodas-worker)
```

###  Alternatives

[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.3M26](/packages/league-geotools)[amphp/parser

A generator parser to make streaming parsers simple.

14952.8M16](/packages/amphp-parser)[amphp/serialization

Serialization tools for IPC and data storage in PHP.

13451.1M18](/packages/amphp-serialization)[enqueue/enqueue

Message Queue Library

19820.0M56](/packages/enqueue-enqueue)[deliciousbrains/wp-background-processing

WP Background Processing can be used to fire off non-blocking asynchronous requests or as a background processing tool, allowing you to queue tasks.

1.1k409.8k6](/packages/deliciousbrains-wp-background-processing)[react/async

Async utilities and fibers for ReactPHP

2238.8M171](/packages/react-async)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
