PHPackages                             neutron/signal-handler - 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. neutron/signal-handler

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

neutron/signal-handler
======================

A library to ease the use of signal handling.

1.0.1(12y ago)13101.4k—0%2MITPHPPHP &gt;=5.3.3

Since Sep 11Pushed 12y ago2 watchersCompare

[ Source](https://github.com/romainneutron/signal-handler)[ Packagist](https://packagist.org/packages/neutron/signal-handler)[ RSS](/packages/neutron-signal-handler/feed)WikiDiscussions master Synced 1mo ago

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

Signal Handler for PHP
======================

[](#signal-handler-for-php)

[![Build Status](https://camo.githubusercontent.com/7aa74cc8da53ebb69ea3dd43b65d97c1060af9398b20b3357c32f155cb7d2772/68747470733a2f2f7472617669732d63692e6f72672f726f6d61696e6e657574726f6e2f7369676e616c2d68616e646c65722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/romainneutron/signal-handler)

A simple signal handler to manage incoming posix signals.

It is implemented as a singleton as `pcntl_signal` can only register one callback per signal.

Using this one, you can register as many callbacks per signal as needed.

For more information about signals, `man signal`.

```
// mandatory to listen to signals
declare(ticks=1);
$handler = Neutron\SignalHandler\SignalHandler::getInstance();
$handler->register(array(SIGINT, SIGTERM), function () { echo "stoppin !"; exit(); });
$handler->register(SIGCONT, function () { echo "all systems go..."; });
```

Register a signal handler
-------------------------

[](#register-a-signal-handler)

```
// register a handler for SIGCONT in default namespace
$handler->register(SIGCONT, function () { echo "SIGCONT received"; });
// register a handler for SIGCONT in "a namespace"
$handler->register(SIGCONT, function () { echo "SIGCONT received"; }, 'a namespace');
// register a handler for SIGCONT in "another namespace"
$handler->register(SIGINT, function () { echo "Interrupted !"; exit(); }, 'another namespace');
```

Unregister signals handler
--------------------------

[](#unregister-signals-handler)

Two ways are available to unregister signals.

By namespace :

```
// unregister all handlers in "another namespace"
$handler->unregisterNamespace('another namespace');
// unregister all SIGINT handlers in "a namespace"
$handler->unregisterNamespace('a namespace', SIGINT);
```

By signal :

```
// unregister all SIGINT handlers in any namespace
$handler->unregisterSignal(SIGINT);
```

License
-------

[](#license)

This project is released under the MIT license.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

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 ~125 days

Total

2

Last Release

4506d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3c264f69af4c60cb9cc98a522b4663f4b6a2708629cabc14409478ab6fc35348?d=identicon)[romain](/maintainers/romain)

---

Top Contributors

[![romainneutron](https://avatars.githubusercontent.com/u/137574?v=4)](https://github.com/romainneutron "romainneutron (6 commits)")

---

Tags

signal

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/neutron-signal-handler/health.svg)

```
[![Health](https://phpackages.com/badges/neutron-signal-handler/health.svg)](https://phpackages.com/packages/neutron-signal-handler)
```

###  Alternatives

[seld/signal-handler

Simple unix signal handler that silently fails where signals are not supported for easy cross-platform development

18271.3M19](/packages/seld-signal-handler)[jbzoo/event

Library for event-based development

29760.0k5](/packages/jbzoo-event)[aura/signal

A SignalSlots/EventHandler implementation; with it, we can invoke handlers ('slots' or 'hooks') whenever an object sends a signal ('notification' or 'event') to the signal manager.

3361.6k4](/packages/aura-signal)

PHPackages © 2026

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