PHPackages                             cellard/process-manager - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. cellard/process-manager

AbandonedLibrary[Utility &amp; Helpers](/categories/utility)

cellard/process-manager
=======================

Manage cron task multi-threading

v1.0.1(4y ago)031MITPHPPHP &gt;=5.6

Since May 24Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Cellard/process-manager)[ Packagist](https://packagist.org/packages/cellard/process-manager)[ RSS](/packages/cellard-process-manager/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (3)Versions (7)Used By (0)

\[Cron\] Process Manager
========================

[](#cron-process-manager)

Manager allows you to control cron task threads.

```
#crontab
* * * * * php example.php
* * * * * php converter.php

```

Only one instance of cron task is allowed. Next one will be rejected if previous still running.

*example.php*

```
$pm = new ProcessManager('example');

if ($pm->lock()) {
    // Do your job

} else {
    // All threads are engaged
}
```

As process management based on process id you do not need to manually release lock, it will be auto released.

Instead of instantiating `ProcessManager` class you may use static shortcut.

```
$pm = ProcessManager::queue('example');
```

Closure style
-------------

[](#closure-style)

In this example two instances of cron task may run simultaneously.

*converter.php*

```
$lock = ProcessManager::queue('converter')
    ->threads(2)
    ->lock(function(ProcessManager $pm) {
        // Do your job

    });

if ( ! $lock) {
    // All threads are engaged
}
```

Subject
-------

[](#subject)

When working with queue, we need to control each task will be executed just once.

We may define process subject with task number (or something like that).

In this example there will be maximum two processes, and each file will be converted just once.

```
$pm = ProcessManager::queue('converter')
    ->threads(2);

if (!$pm->lock()) {
    exit('Too many threads');
}

while (FilesToConvert::getOne() as $filename) {
    if (!$pm->subject($filename)->lock()) {
        // file is converting now by other thread
        continue;
    }

    // Your code to convert file here
}
```

This example may be shortened.

```
while (FilesToConvert::getOne() as $filename) {
    ProcessManager::queue('converter')
        ->threads(2)
        ->subject($filename)
        ->lock(ProcessManager $pm) use ($filename) {
            // Your code to convert file here
        });
}
```

How it works
------------

[](#how-it-works)

Process Manager keeps locks with process id. It watches if process is alive and automatically releases lock if process disappears.

Even if your task running for hours — manager will watch it activity.

### Drivers

[](#drivers)

#### Filesystem

[](#filesystem)

Used by default. Manager keeps lock files in system temp directory, but you may redefine it.

```
ProcessManager::$driver = new \Cellard\ProcessManager\Drivers\FilesystemDriver(/* optional */ $loc_dir);
```

#### Redis

[](#redis)

```
ProcessManager::$driver = new \Cellard\ProcessManager\Drivers\RedisDriver(/* optional */ $predis_config);
```

### Namespaces

[](#namespaces)

As manager store locks in Filesystem or in Redis keys, it is possible that different projects will use the same names. To prevent conflicts it is recommended to redefine manager's prefix.

```
ProcessManager::$prefix = 'your-project-name';
```

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

Every ~152 days

Recently: every ~190 days

Total

6

Last Release

1464d ago

Major Versions

0.4 → 1.02020-05-26

PHP version history (2 changes)0.1PHP ^5.6|^7

v1.0.1PHP &gt;=5.6

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1220316?v=4)[Michael Michaelson](/maintainers/Cellard)[@Cellard](https://github.com/Cellard)

---

Top Contributors

[![Cellard](https://avatars.githubusercontent.com/u/1220316?v=4)](https://github.com/Cellard "Cellard (19 commits)")

---

Tags

multi-threadingcronthreads

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cellard-process-manager/health.svg)

```
[![Health](https://phpackages.com/badges/cellard-process-manager/health.svg)](https://phpackages.com/packages/cellard-process-manager)
```

###  Alternatives

[dragonmantank/cron-expression

CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due

4.7k498.1M665](/packages/dragonmantank-cron-expression)[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

23.8k69.4k](/packages/grumpydictator-firefly-iii)[lorisleiva/cron-translator

Makes CRON expressions human-readable

3149.2M37](/packages/lorisleiva-cron-translator)[symfony/scheduler

Provides scheduling through Symfony Messenger

9012.8M97](/packages/symfony-scheduler)[mybuilder/cronos

Configure Cron task through PHP

152533.7k2](/packages/mybuilder-cronos)[butschster/cron-expression-generator

Cron expression generator

511.7M2](/packages/butschster-cron-expression-generator)

PHPackages © 2026

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