PHPackages                             resgen/lumen-proc - 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. resgen/lumen-proc

ActiveLibrary

resgen/lumen-proc
=================

v1.0.223(1mo ago)0617GPL-3.0+PHPCI failing

Since Oct 29Pushed 2y ago1 watchersCompare

[ Source](https://github.com/resgen/lib-lumen-proc)[ Packagist](https://packagist.org/packages/resgen/lumen-proc)[ RSS](/packages/resgen-lumen-proc/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (6)Versions (19)Used By (0)

Lumen Process Control Drivers
=============================

[](#lumen-process-control-drivers)

Process control for running artisan commands as a deamon. Respects all sigterm commands sent. Includes TTL driver and RunOnce drivers. This should work for Laravel too, but its only been tested with lumen.

Why?
----

[](#why)

When running artisan commands as a background deamon process, the ProcessControl will ensure that SIGTERMs are respected. This is especially important when running artisan commands as the docker entrypoint. It will respect docker's kill signal and give you a chance to finish work before exiting.

Install
-------

[](#install)

With composer:

```
composer require resgen/lumen-proc:1.0.*
```

Ensure pcntl\_async\_signals is enabled for your php install. Example docker alpine RUN:

```
RUN docker-php-ext-install pcntl
```

Configuration
-------------

[](#configuration)

Add the laravel service provider `Resgen\Common\Proc\ProcessControlProvider` to your app.

Then add the following ENV var with the selected driver:

```
LUMEN_PROC_DRIVER=runonce
```

By default, the TTL drivers will log an INFO heart beat every ~5 seconds. You can also disable the heart beat log by doing:

```
LUMEN_PROC_HEARTBEAT=disabled
```

You may enable `SignalException` to be thrown asynchronously when a signal is processed, this will happen from wherever your normal code is being executed and gives you a chance to clean things up gracefully while still responding immediately to signals (or ignore them if appropriate.)

```
LUMEN_PROC_THROW_SIGNAL_EXCEPTION=enabled
```

Available Drivers
-----------------

[](#available-drivers)

#### TtlProcessDriver

[](#ttlprocessdriver)

ENV name: `ttl`.

Runs for N number of seconds. Defaults to 300s runtime. Logs a heart beat message every ~6 seconds. You can adjust the runtime by setting the `LUMEN_PROC_TTL=1000s`. Will exit if a SIGTERM is sent. Intended to be used with a process supervisor like runit, supervisord or inside a docker orchestration env like kubernetes.

#### TtlInstantKillProcessDriver

[](#ttlinstantkillprocessdriver)

ENV name: `ttl_hardexit`.

Same as TtlProcessDriver, but throws exception as soon as signal is recieved.

#### KeepAliveProcessDriver

[](#keepaliveprocessdriver)

ENV name: `keepalive`.

Runs until a SIGTERM signal is sent. Not recommended for production usage. Processes should cycle.

#### RunOnceProcessDriver

[](#runonceprocessdriver)

ENV name: `runonce`.

Will escape immediately when `check()` is called.

Example Usage
-------------

[](#example-usage)

```
class ExampleCommand extends LoopingCommand
{
    /** {@inheritDoc} */
    protected $name = 'resgen';

    /** {@inheritDoc} */
    protected $signature = 'resgen:example';

    /** {@inheritDoc} */
    protected function init()
    {
        // Called prior to the first loop
        // returning `false` will cause the command to stop & exit
    }

    /** {@inheritDoc} */
    protected function loop()
    {
        // Called repeatedly until an exit signal is received or thrown

        return 1;   // Return the number of seconds to sleep/idle until loop() should be called again
    }

    /** {@inheritDoc} */
    protected function exiting()
    {
        // Called just prior to command handler returns for cleanup
    }
}
```

Cron Calls
----------

[](#cron-calls)

`LoopingCommand` automatically enables internal cron calls of functions to occur at regular intervals. This check happens each time `loop()` returns control or while the command is sleeping.

### Example Usage

[](#example-usage-1)

```
class ExampleCommand extends LoopingCommand
{
    /* ...snip... */
    protected function init()
    {
        $this->cron()
            ->dirCheck('/tmp')
            ->every(5);

        $this->cron()
            ->report()
            ->every(60);
    }

    /** Check that $dir exists, if not, create it. */
    protected function dirCheck($dir)
    {
        if(!is_dir($dir)) {
            mkdir($dir, 0777, true);
        }
    }

    /** Report on the current state every 60 seconds */
    protected function report()
    {
        Log::info('Sample report every 60 seconds.');
    }

}
```

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 76.2% 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 ~168 days

Recently: every ~437 days

Total

15

Last Release

34d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9290674bc76dcf2516eb568ac6dd972c9cf77e6f1492fc869b491a2740ba95c1?d=identicon)[philipwhitt](/maintainers/philipwhitt)

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

---

Top Contributors

[![philipwhitt](https://avatars.githubusercontent.com/u/5478888?v=4)](https://github.com/philipwhitt "philipwhitt (16 commits)")[![cpriest](https://avatars.githubusercontent.com/u/159323?v=4)](https://github.com/cpriest "cpriest (5 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/resgen-lumen-proc/health.svg)

```
[![Health](https://phpackages.com/badges/resgen-lumen-proc/health.svg)](https://phpackages.com/packages/resgen-lumen-proc)
```

###  Alternatives

[darkaonline/swagger-lume

OpenApi or Swagger integration to Lumen

3372.3M3](/packages/darkaonline-swagger-lume)[pearl/lumen-request-validate

Lumen doesn't have form request validator seperatly. This package helps developers to segregate the validation layer from the controller to a separate dedicated class

45390.3k2](/packages/pearl-lumen-request-validate)[albertcht/lumen-testing

Testing Suite For Lumen like Laravel does.

4335.5k1](/packages/albertcht-lumen-testing)[niellles/lumen-commands

Adds artisan commands to Lumen that aren't available by default.

1860.1k](/packages/niellles-lumen-commands)[rogervila/lumen-rate-limiting

 Lumen port of Laravel ThrottleRequests middleware

1662.5k1](/packages/rogervila-lumen-rate-limiting)[rdehnhardt/lumen-maintenance-mode

Define application maintenance mode.

2526.3k1](/packages/rdehnhardt-lumen-maintenance-mode)

PHPackages © 2026

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