PHPackages                             arkanmgerges/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. arkanmgerges/worker

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

arkanmgerges/worker
===================

Worker thread used to run your callback in another process

0.1.0(11y ago)640MITPHPPHP &gt;=5.4.0

Since Jul 6Pushed 10y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (2)Used By (0)

Description
-----------

[](#description)

Worker is a simple library that will allow the user to provide a function or class method to be executed into a separate php process, beside this, it accepts on success function or class method, and on error function or class method.

License
-------

[](#license)

Licensed under [MIT](http://www.opensource.org/licenses/mit-license.php). Totally free for private or commercial projects.

Requirement
-----------

[](#requirement)

The library needs PHP 5.4+.

Installation
------------

[](#installation)

In your composer.json add the following in the **require** section:

```
{
    "require": {
        "arkanmgerges/worker": "dev-master"
    }
}

```

And then:

```
php composer.phar update
```

or if you have installed composer in your system to be called directly without php then:

```
composer update
```

Tutorial
--------

[](#tutorial)

### 1. Use Worker

[](#1-use-worker)

```
Use Worker\Worker
```

### 2. Using Anonymous Function

[](#2-using-anonymous-function)

```
$worker = new Worker(
    // Here you can provide your main callback
    function($arg1 = '', $arg2 = '') {
        file_put_contents('result.txt', $arg1 . $arg2);
    },
    // The second one is used when main callback has completed successfully
    function() {
        file_put_contents('success.txt', 'success');
    },
    // If an exception has happened in the main callback then this callback will be called with an error message
    function($e) {
        file_put_contents('error.txt', 'error');
    }
);

// Start the worker, and pass 2 arguments to the main callback. It is also possible to pass more arguments
$worker->start('first arg', 'second arg');
```

### 3. Using Class Object Method

[](#3-using-class-object-method)

```
class SomeClass
{
    public function method($arg1, $arg2, $arg3)
    {
        file_put_contents('result.txt', $arg1 . $arg2 . $arg3);
    }
};
```

And then somewhere:

```
$object = new SomeClass();
// Pass array, first item is the object and second item is the name of the class method
$worker = new Worker([$object, 'method']);
// Start worker and send 3 arguments
$worker->start('from', ' object method', ', this is nice');
```

### 4. Using Class Static Method

[](#4-using-class-static-method)

```
class SomeClass
{
    public static function method($arg1, $arg2, $arg3)
    {
        file_put_contents('result.txt', $arg1 . $arg2 . $arg3);
    }
};
```

And somewhere:

```
$worker = new Worker(__NAMESPACE__ . '\SomeClass::method');
$worker->start('from', ' class method', ', nice');
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4332d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c2fd1c17cb2c388dea1aa48a57a895ef6675155161334ea415c2130bc967b234?d=identicon)[arkanmgerges](/maintainers/arkanmgerges)

---

Top Contributors

[![arkanmgerges](https://avatars.githubusercontent.com/u/7836805?v=4)](https://github.com/arkanmgerges "arkanmgerges (3 commits)")

---

Tags

processworkerparallel callback

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[swarrot/swarrot

A simple lib to consume RabbitMQ queues

3654.4M8](/packages/swarrot-swarrot)[dusterio/laravel-aws-worker

Run Laravel (or Lumen) tasks and queue listeners inside of AWS Elastic Beanstalk workers

3105.7M](/packages/dusterio-laravel-aws-worker)[clue/mq-react

Mini Queue, the lightweight in-memory message queue to concurrently do many (but not too many) things at once, built on top of ReactPHP

144691.7k4](/packages/clue-mq-react)[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

53541.0k3](/packages/jolicode-castor)[qxsch/worker-pool

Runs tasks in a parallel processing workerpool.

108325.7k1](/packages/qxsch-worker-pool)[qruto/laravel-flora

Install and update Laravel application with single command

13197.8k](/packages/qruto-laravel-flora)

PHPackages © 2026

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