PHPackages                             nexxes/daemonhelper - 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. nexxes/daemonhelper

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

nexxes/daemonhelper
===================

Helper classes for daemon processes written in PHP

022PHP

Since Feb 5Pushed 8y ago1 watchersCompare

[ Source](https://github.com/nexxes/php-daemonhelper)[ Packagist](https://packagist.org/packages/nexxes/daemonhelper)[ RSS](/packages/nexxes-daemonhelper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

php-daemonhelper
================

[](#php-daemonhelper)

Helper classes for daemon processes written in PHP, licenced under the LGPL v3.

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

[](#installation)

Just put the following in your `composer.json` file inside your project root. No stable version exists so far.

```
"require": {
  "nexxes/daemonhelper": "*@dev"
}
```

Features
--------

[](#features)

### Daemonize a process

[](#daemonize-a-process)

```
// Daemonize the current process:
// - process will be detached from terminal and becomes process group leader
// - stdin/stderr will be closed and reopened to the supplied files (default is /dev/null)
// - daemon will re-exec itself so STDIN, STDOUT, STDERR constants are fixed
\nexxes\Daemon::daemonize('run/process.pid', 'log/stderr.log', 'log/stdout.log', 'stdin.txt');

// Code after daemonizing follows here
// ...
```

### WatchDog to restart a worker process on error

[](#watchdog-to-restart-a-worker-process-on-error)

```
// Fork the real worker process
\nexxes\WatchDog::run();

// Code for the worker process
// If the process dies with exit-value != 0,
// we start here again and again and again
// ..
```

### WatchDog for multiple worker processes

[](#watchdog-for-multiple-worker-processes)

```
// Multiple processes can be handled by a watchdog instance
$watchdog = new \nexxes\WatchDog();

$watchdog->addProcess('processName1', function() {
  // Code for process 1
  // If the process dies with exit-value != 0,
  // we start here again ...
});

$watchdog->addProcess('processNameX', function() {
  // Register as many processes as you need.
  // You can register anything callable, not only closures.
});

// Execute the processes and restart them if needed:
$watchdog->start();
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

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://www.gravatar.com/avatar/2b38daf7ea29726e8f479a49857e46ebe2396b354ce31dfabcf504633af43de1?d=identicon)[dennisbirkholz](/maintainers/dennisbirkholz)

---

Top Contributors

[![DennisBirkholz](https://avatars.githubusercontent.com/u/600655?v=4)](https://github.com/DennisBirkholz "DennisBirkholz (21 commits)")

### Embed Badge

![Health badge](/badges/nexxes-daemonhelper/health.svg)

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

###  Alternatives

[bkuhl/php-selector

1412.7k](/packages/bkuhl-php-selector)

PHPackages © 2026

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