PHPackages                             resolute/laravel-pseudo-daemon - 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. [CLI &amp; Console](/categories/cli)
4. /
5. resolute/laravel-pseudo-daemon

Abandoned → [hammerstonedev/laravel-pseudo-daemon](/?search=hammerstonedev%2Flaravel-pseudo-daemon)Library[CLI &amp; Console](/categories/cli)

resolute/laravel-pseudo-daemon
==============================

A Laravel package to mimic daemons via scheduled commands without having to change server configuration.

v1.1.0(3y ago)937.6k↓100%13[3 issues](https://github.com/aarondfrancis/laravel-pseudo-daemon/issues)[1 PRs](https://github.com/aarondfrancis/laravel-pseudo-daemon/pulls)MITPHP

Since May 17Pushed 2y ago1 watchersCompare

[ Source](https://github.com/aarondfrancis/laravel-pseudo-daemon)[ Packagist](https://packagist.org/packages/resolute/laravel-pseudo-daemon)[ RSS](/packages/resolute-laravel-pseudo-daemon/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (7)Used By (0)

🚨🚨 Do not use
=============

[](#-do-not-use)

You should probably use the framework's built-in [sub-minute scheduled tasks](https://laravel.com/docs/10.x/scheduling#sub-minute-scheduled-tasks) now instead of this package. I'll mark it as abandoned at some point!

Laravel Pseudo-Daemons
======================

[](#laravel-pseudo-daemons)

A Laravel package to mimic daemons via scheduled commands without having to change server configuration.

> For more information / rationale, see .

Installation
============

[](#installation)

You can install the package via composer:

`composer require Hammerstone/laravel-pseudo-daemon`

Basic Usage
===========

[](#basic-usage)

Add the `IsPseudoDaemon` trait to any of your Laravel Commands and call `runAsPseudoDaemon` from the `handle` method.

```
class TestCommand extends Command
{
    use \Hammerstone\PseudoDaemon\IsPseudoDaemon;

    public function handle()
    {
        $this->runAsPseudoDaemon();
    }

    /**
     * This is the main method that will be kept alive.
     */
    public function process()
    {
        // All of your processing...
    }
}
```

Then, in your `Console\Kernel`, run your command with the `daemonize` modifier. This is a macro that sets it to run every minute, in the background, without overlapping.

```
// Kernel.php

// Use the daemonize macro.
$schedule->command('test')->daemonize();

// Or use the underlying methods.
$schedule->command('test')
    ->everyMinute()
    ->runInBackground()
    ->withoutOverlapping();
```

The `process` method will be kept alive for as long as you want, all controlled by your code without any Supervisor configuration, and without having to change your deploy scripts to kill it.

Stopping the Daemon
===================

[](#stopping-the-daemon)

Obviously there are going to be times you need to kill your daemon so that the scheduler can restart it. The most obvious time is when deploying new code, but there are plenty of other reasons to kill it off, and several ways to do so.

Restart After Number Of Times Run
---------------------------------

[](#restart-after-number-of-times-run)

If you'd like to stop the daemon after it runs a certain number of times, you can override the `restartAfterNumberOfTimesRun()` method. By default, it returns `1000` in production and `1` otherwise.

Restart After Minutes
---------------------

[](#restart-after-minutes)

To set a maximum runtime in minutes, override `restartAfterMinutes()`. By default the daemons all run for 60 minutes.

Restart When Something Arbitrary Changes
----------------------------------------

[](#restart-when-something-arbitrary-changes)

You'll want to kill your daemons when you deploy new code, which is easy enough with the `restartWhenChanged()` method. You can return any data you want from this method, and if it ever changes the daemon will stop.

### Forge + Envoyer

[](#forge--envoyer)

If you're using on Laravel Forge with Envoyer, the trait will automatically handle stopping itself whenever you deploy fresh code. You don't have to do a single thing! The trait will read the real path of the `current` symlink that Envoyer creates. Anytime that changes the daemon will stop.

### Other Hosting

[](#other-hosting)

If you're not on Forge with Envoyer, you can extend the `restartWhenChanged()` method and return whatever you want. You can read a git hash, a build time, or do anything else. Anytime we detect that the data is different, the loop breaks.

Here's an example that reads the current git hash:

```
public function restartWhenChanged()
{
    // Restart whenever the git hash changes.
    // https://stackoverflow.com/a/949391/1408651
    return shell_exec('git rev-parse HEAD');
}
```

Stopping Whenever You Want
--------------------------

[](#stopping-whenever-you-want)

If you'd like to initiate a stop from inside your `process` method, you may return `PseudoDaemonControl::STOP` and the daemon will not run any more iterations.

Sleeping
========

[](#sleeping)

So that your daemon doesn't run thousands of times per minute when there is nothing to do, we default to sleeping 7 seconds between iterations. If you'd like to change that amount you may override `pseudoDaemonSleepSeconds()`.

If you'd like to explicitly *not* sleep on a certain iteration, you may return `PseudoDaemonControl::DONT_SLEEP` from your `process` method.

Running Code Before / After
===========================

[](#running-code-before--after)

If you'd like to do some setup and/or cleanup outside of the main loop, `beforePseudoDaemonRun()` and `beforePseudoDaemonShutdown()` are both available to you.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 93.9% 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 ~265 days

Total

5

Last Release

1125d ago

Major Versions

v0.3.0 → v1.0.02022-03-31

### Community

Maintainers

![](https://www.gravatar.com/avatar/033238953a59b9223a1bde703b5e4254e63c7412195da1cb9de5af44bf53fc0a?d=identicon)[aarondfrancis](/maintainers/aarondfrancis)

---

Top Contributors

[![aarondfrancis](https://avatars.githubusercontent.com/u/881931?v=4)](https://github.com/aarondfrancis "aarondfrancis (31 commits)")[![grantjanecek](https://avatars.githubusercontent.com/u/17169721?v=4)](https://github.com/grantjanecek "grantjanecek (1 commits)")[![tontonsb](https://avatars.githubusercontent.com/u/16481303?v=4)](https://github.com/tontonsb "tontonsb (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/resolute-laravel-pseudo-daemon/health.svg)

```
[![Health](https://phpackages.com/badges/resolute-laravel-pseudo-daemon/health.svg)](https://phpackages.com/packages/resolute-laravel-pseudo-daemon)
```

###  Alternatives

[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[nunomaduro/laravel-console-menu

Laravel Console Menu is an output method for your Laravel/Laravel Zero commands.

815412.0k48](/packages/nunomaduro-laravel-console-menu)[bestmomo/nice-artisan

Web interface for Laravel Artisan

215149.3k](/packages/bestmomo-nice-artisan)[statamic/cli

Statamic CLI Tool

7587.7k](/packages/statamic-cli)[mwguerra/web-terminal

A web-based terminal component for Filament/Laravel with command whitelisting and multiple connection types

251.1k](/packages/mwguerra-web-terminal)[sunaoka/laravel-facade-generator

Provide command line generation of facade layer files.

171.9k](/packages/sunaoka-laravel-facade-generator)

PHPackages © 2026

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