PHPackages                             codesvault/cadence - 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. codesvault/cadence

ActiveLibrary[CLI &amp; Console](/categories/cli)

codesvault/cadence
==================

Cadence creates and manages PHP daemons with ease for running all heavy-lifting tasks in the background.

1.0.2(2mo ago)6171MITPHPPHP &gt;=8.1

Since Feb 4Pushed 1mo agoCompare

[ Source](https://github.com/CodesVault/cadence)[ Packagist](https://packagist.org/packages/codesvault/cadence)[ Fund](https://wise.com/pay/me/keramot-ul-i?utm_source=quick_pay)[ RSS](/packages/codesvault-cadence/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (6)Used By (0)

Cadence
=======

[](#cadence)

Cadence creates and manages PHP daemons with ease for running all heavy-lifting tasks in the background.

Running cron jobs and background tasks in PHP typically requires system-level configuration, custom process management, or framework-specific solutions. Cadence eliminates this complexity. It turns any existing code into a managed daemon without modifications. It handles the repetitive execution cycle, memory management, graceful restarts, and structured logging so you can focus on your application logic. Enables real-time debugging by streaming output directly to your terminal or log files. Works standalone for development or pairs with Supervisor for production deployments.

[![Total Downloads](https://camo.githubusercontent.com/5aeeb8a19f22877955f7e3e99952c20a81ff3dbbadff71a72f684126204d024f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6465737661756c742f636164656e63652e737667)](https://packagist.org/packages/codesvault/cadence)[![Latest Version](https://camo.githubusercontent.com/68f180b6c4281a1199f7991a0e74b2710d8a3323ef23d21aeea040508a008f1c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f6465737661756c742f636164656e63652e737667)](https://packagist.org/packages/codesvault/cadence)

[![PHP Version](https://camo.githubusercontent.com/66c7c2d02e0483c69d41499f393ea9262fa7b4a4bd225f2da14cc0e4d8008e63/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f636f6465737661756c742f636164656e63652e737667)](https://packagist.org/packages/codesvault/cadence)[![Composer](https://camo.githubusercontent.com/569b817a1245570fba97954242751967d1fcb509a7c1094b71c75b2649fbcfa8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f6d706f7365722d322e302532422d626c75652e737667)](https://getcomposer.org/)[![License](https://camo.githubusercontent.com/bca62e4f815f5785eb2d277a1830bc6a87c70aabd2a7da39b1164cf7b729e2dd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f636f6465737661756c742f636164656e63652e737667)](LICENSE)

Why Cadence?
------------

[](#why-cadence)

ChallengeWithout CadenceWith Cadence**Running background tasks**Write custom loop scripts, manage sleep cycles, handle exits manually`cadence /path/to/script.php` — done**Memory leaks**Processes grow until they crash or get killedAuto-restarts when memory limit is reached**Process crashes**Cron runs once and fails silently, no retryContinuous execution with structured error logging**Debugging**Tail log files, add var\_dump, redeployReal-time output in terminal or dedicated debug log file**Configuration**Edit crontab, modify system configs, restart services`.env` file or CLI flags, no system changes needed**Framework dependency**Laravel Scheduler, Symfony Messenger — locked to one frameworkFramework agnostic, works with any PHP script or CLI command
Features
--------

[](#features)

- Use with Supervisor for robust process management in production environments
- Run on foreground for development and debugging purposes
- Run Cron jobs as daemons without modifying existing code
- Start and stop daemons with ease
- Monitor process status
- Handle process logs
- Easy integration with existing PHP applications
- Framework agnostic, works with any PHP framework or plain PHP scripts
- Process Registry

*Click to play Demo Video* ⬇️

[![Cadence](https://camo.githubusercontent.com/c19c21da059384d9ffb5afa589cad7952acb8e26f25c1f44d0ec37761f07571c/68747470733a2f2f7075622d35666336303562303461346334363763613461336662656433363164656166392e72322e6465762f636164656e63652d64656d6f2f636164656e63652d64656d6f2d436f7665722e6a7067)](https://pub-5fc605b04a4c467ca4a3fbed361deaf9.r2.dev/cadence-demo/cadence-demo.mp4)

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

[](#installation)

Install Cadence via Composer. It's recommanded to install Cadence as a global dependency. Run the following command in terminal:

```
composer global require codesvault/cadence
```

Make sure Composer's global bin directory is in your system's PATH:

`export PATH="$PATH:$HOME/.composer/vendor/bin"`

Then run the following command to verify the installation:

```
cadence --help
```

It's recommended to use Cadence as a global dependency for easier access to the `cadence` command from any location in your terminal. Alternatively, you can install Cadence as a project dependency:

```
composer require codesvault/cadence
```

Usages for Development and Debugging
------------------------------------

[](#usages-for-development-and-debugging)

Developers can run Cadence on the foreground for development and real-time debugging purposes. This allows to run background-process and see real-time output and logs directly in your terminal or in log file.

### Basic Usage

[](#basic-usage)

```
cadence  [options]

# Or

cadence  [options]
```

### Examples

[](#examples)

```
cadence /var/www/html/wp-cron.php

cadence /var/www/html/wp-cron.php --interval 10 --max-memory 256M

cadence '/var/www/html/artisan schedule:run' --env /var/www/.env

# with cli command
cadence 'curl -s https://example.com/webhook' -i 60
cadence 'echo hello' -n 5
```

### Commands

[](#commands)

NameDescription`stop `Stop a running daemon by name`status `Show status of a daemon by name`list`List all registered daemons
### Options

[](#options)

ShortLongTypeDescription`-i``--interval`INTSleep interval between runs \[default: 60\]`-m``--max-memory`STRINGMaximum memory usage before restart (e.g., 128M, 1G) \[default: 128M\]`-t``--max-runtime`INTMaximum runtime in seconds before restart \[default: 3600\]`-n``--max-cycles`INTMaximum number of cycles before restart \[default: unlimited\]`-lf``--log-file`STRINGPath to log file \[default: none\]`-ll``--log-level`STRINGLogging level (debug, info, warning, error) \[default: info\]`-e``--env`STRINGPath to .env file for configuration \[default: auto-detect\]`-v``--version`-Display the version information`-q``--quiet`-Suppress all output except errors`-c``--config`-Show current configurations`--name`STRINGName for the daemon process \[default: auto-derived\]`-h``--help`-Display this help message
### Environment Configuration

[](#environment-configuration)

Cadence can automatically detect and load environment variables from a `.env` file located in the same directory as your script. For example, if your script is located at `/var/www/html/wp-cron.php`, Cadence will look for a `.env` file at `/var/www/html/.env`.

You can also specify a custom path to the `.env` file using the `--env` option. The following environment variables can be used to configure Cadence:

VariableDescriptionDefault`CAD_INTERVAL`Interval between Cycles in seconds60`CAD_MAX_MEMORY`Maximum memory usage before restart (e.g., 128M, 1G)128M`CAD_MAX_RUNTIME`Maximum runtime in seconds before restart3600`CAD_MAX_CYCLES`Maximum number of cycles before restartunlimited`CAD_LOG_FILE`Path to log filenone`CAD_LOG_LEVEL`Logging level (debug, info, warning, error)info`CAD_DEBUG_LOG_FILE`Path to debug log filenone
Production Usage with Supervisor
--------------------------------

[](#production-usage-with-supervisor)

In production environments, it's recommended to use Cadence in conjunction with [Supervisor](https://supervisord.org/).

### Supervisor Installation &amp; Configuration

[](#supervisor-installation--configuration)

Supervisor is a process control system that allows you to monitor and control long-running background processes. Install Supervisor on your Linux server:

```
sudo apt-get install supervisor
```

Create a Supervisor configuration file for Cadence process. For example, create a file named `cadence.conf` in `/etc/supervisor/conf.d/` with the following configuration:

```
[program:cadence]
command=cadence /var/www/html/wp-cron.php
directory=/var/www/html
autostart=true
autorestart=true
stderr_logfile=/var/log/cadence_wp_cron.err.log
stdout_logfile=/var/log/cadence_wp_cron.out.log
user=www-data
```

Now make a `.env` file in `/var/www/html/` directory for environment variables if needed. Cadence will automatically load the environment variables from this file.

```
CAD_LOG_FILE=/var/www/html/cad.log
CAD_LOG_LEVEL=debug
CAD_DEBUG_LOG_FILE=/var/www/html/cad_debug.log
CAD_INTERVAL=5
CAD_MAX_CYCLES=6
CAD_MAX_MEMORY=128M
```

### Managing Cadence with Supervisor

[](#managing-cadence-with-supervisor)

You can manage the Cadence process using Supervisor commands:

```
# Start the Cadence process
sudo supervisorctl start cadence
# Stop the Cadence process
sudo supervisorctl stop cadence
# Restart the Cadence process
sudo supervisorctl restart cadence
# Check the status of the Cadence process
sudo supervisorctl status cadence
```

Managing Cadence with Crontab
-----------------------------

[](#managing-cadence-with-crontab)

Cadence works seamlessly with system crontab. Use `--max-cycles 1` to run a script once and exit — cron handles the scheduling, Cadence handles the execution with logging, memory tracking, and error capture.

### Setting Up Crontab

[](#setting-up-crontab)

Edit your crontab:

```
crontab -e
```

Add entries using the format:

```
# ┌───────────── minute (0-59)
# │ ┌───────────── hour (0-23)
# │ │ ┌───────────── day of month (1-31)
# │ │ │ ┌───────────── month (1-12)
# │ │ │ │ ┌───────────── day of week (0-6, Sunday=0)
# │ │ │ │ │
# * * * * * command
```

### Examples

[](#examples-1)

```
# Run WordPress cron every 5 minutes
*/5 * * * * cadence /var/www/html/wp-cron.php --max-cycles 1

# Run Laravel scheduler every minute with logging
* * * * * cadence '/var/www/html/artisan schedule:run' --max-cycles 1 --log-file /var/log/cadence-laravel.log

# Run a cleanup script daily at 3:00 AM
0 3 * * * cadence /var/www/html/cleanup.php --max-cycles 1 --log-file /var/log/cadence-cleanup.log --log-level warning

# Call a webhook every hour
0 * * * * cadence 'curl -s https://example.com/webhook' --max-cycles 1
```

Since crontab runs without a terminal, use `--log-file` to capture output and `--log-level` to control verbosity.

Contribution Guidelines
-----------------------

[](#contribution-guidelines)

We welcome contributions to Cadence! Whether it's a bug fix, new feature, or documentation improvement, your help is appreciated. Please follow our [contributing guidelines](CONTRIBUTING.md) to get started.

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance92

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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

Total

4

Last Release

87d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8078871c211cddf84f3fcff8321f973ed3324aa0c54d0d8a2b5c3ad9ffa2fca2?d=identicon)[abmSourav](/maintainers/abmSourav)

---

Top Contributors

[![AbmSourav](https://avatars.githubusercontent.com/u/39233955?v=4)](https://github.com/AbmSourav "AbmSourav (45 commits)")

---

Tags

background-jobsbackground-processcrondaemonphpphp-background-jobwordpressschedulerclicronworkerdaemonprocess managerbackground processbackground job

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/codesvault-cadence/health.svg)

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

###  Alternatives

[jmose/command-scheduler-bundle

This Symfony bundle will allow you to schedule all your commands just like UNIX crontab

3361.4M1](/packages/jmose-command-scheduler-bundle)[crunzphp/crunz

Schedule your tasks right from the code.

2292.0M6](/packages/crunzphp-crunz)[aplus/cli

Aplus Framework CLI Library

2301.7M6](/packages/aplus-cli)[wrep/daemonizable-command

Daemonizable (endless running) commands for Symfony.

2271.5M6](/packages/wrep-daemonizable-command)[clio/clio

Lightweight utility and helper classes for CLI applications

92279.2k3](/packages/clio-clio)[a-bashtannik/fasti

Laravel task scheduler with calendar-based management.

133.6k](/packages/a-bashtannik-fasti)

PHPackages © 2026

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