PHPackages                             nr/processcronjobs - 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. nr/processcronjobs

ActivePw-module[Utility &amp; Helpers](/categories/utility)

nr/processcronjobs
==================

Manage the execution of CronJobs

12[1 issues](https://github.com/neuerituale/ProcessCronJobs/issues)PHP

Since Oct 15Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/neuerituale/ProcessCronJobs)[ Packagist](https://packagist.org/packages/nr/processcronjobs)[ RSS](/packages/nr-processcronjobs/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

ProcessCronJobs
===============

[](#processcronjobs)

What it does
------------

[](#what-it-does)

The module provides paths under which cronjobs can be registered. It lists all registered cronjobs and can execute individual ones manually. The last execution, the last status and, in the event of an error, the last error message are displayed.

Features
--------

[](#features)

- Clear overview of all registered CronJobs
- Easy to set timing (onInit or onReady) and delay (LazyCron)
- Individual path (endpoint) that executes the CronJobs. Configuration of a secret path segment and additional path segments (namespaces) for selected CronJobs.
- Display of the time of the last execution and any error messages

Install
-------

[](#install)

1. Copy the files for this module to /site/modules/ProcessCronJobs/
2. In admin: Modules &gt; Refresh. Install ProcessCronJobs.
3. Go to Setup &gt; CronJobs
4. Copy and Install example Module (`modules/ProcessCronJobs/example/ProcessCronJobsRegistration.module.example`) to register your CronJobs in the `__constructor()` method. You can also use any other `__constructor()` method. It makes sense to register the CronJobs as early as possible so that they can also be executed on onInit.
5. Set up the real cron that calls the ProcessCronJobs provided endpoint.
    - Type `crontab -e` in your unix console
    - Add this line and save the file: `* * * * * curl --silent "https://example.com/cron/"` [Find out more about setting up CronJobs (Wikipedia).](https://en.wikipedia.org/wiki/Cron)

Install via composer
--------------------

[](#install-via-composer)

1. Execute the following command in your website root directory. ```
    composer require nr/processcronjobs
    ```

Register a CronJob
------------------

[](#register-a-cronjob)

### Simple

[](#simple)

A simple example for registering a CronJob.

```
wire()->addHookBefore('ProcessCronJobs::register', function(HookEvent $event){
	/** @var ProcessCronJobs $processCronJobs */
	$processCronJobs = $event->object;
	$processCronJobs->add(
		'SuperSimpleCronJobOnDemand',
		function(CronJob $cron){ echo "Hello Cron"; },
	);
});
```

### Delayed

[](#delayed)

This CronJob should run once a day at init.

```
wire()->addHookBefore('ProcessCronJobs::register', function(HookEvent $event){
	/** @var ProcessCronJobs $processCronJobs */
	$processCronJobs = $event->object;
	$processCronJobs->add(
		'MyFirstCronJobEveryDay',
		function(CronJob $cron){ echo "What a beautiful day"; },
		[
			'lazyCron' => 'LazyCron::everyDay',
			'timing' => CronJob::timingInit,
		]
	);
});
```

### Long Running

[](#long-running)

This CronJob runs for a very long time and is called directly by a "real" CronJob so as not to block other CronJobs. The endpoint for this CronJob is  or [https://example.com/cron/###your\_secret###/longrunning/](https://example.com/cron/###your_secret###/longrunning/).

CronJobs that have a namespace (own path segment) cannot be delayed with LazyCron, because LazyCron can only be started by a single request. LazyCron creates a lock file and thus blocks the execution of parallel calls.

```
wire()->addHookBefore('ProcessCronJobs::register', function(HookEvent $event){
	/** @var ProcessCronJobs $processCronJobs */
	$processCronJobs = $event->object;
	$processCronJobs->add(
		'SuperLongRunningSpecialCronJob',
		function(CronJob $cron){ echo "I have so much work to do"; },
		[
			'timing' => CronJob::timingInit,
			'ns' => 'longrunning'
		]
	);
});
```

Process View
------------

[](#process-view)

[![ProcessView](https://user-images.githubusercontent.com/11630948/268062278-458b8060-a81d-4149-822d-6e3453a043a1.png)](https://user-images.githubusercontent.com/11630948/268062278-458b8060-a81d-4149-822d-6e3453a043a1.png)

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

[](#configuration)

`Modules` &gt; `Configure` &gt; `ProcessCronJobs`

You will find the following configuration options in the module settings:

- The trigger path, i.e. the path that triggers the CronJob processing, can be adjusted here (default: cron/).
- A secret path segment can be created that must be appended to the trigger path so that processing is started.
- Automatic processing can generally be stopped (status).
- The cache of ProcessCronJobs can be emptied. Things like the time of the last call, the status of the last call and possibly an error message are stored in the cache.

[![Configuration](https://user-images.githubusercontent.com/11630948/268075104-79d78c14-ea8a-4735-80ee-1c32ecddd73d.png)](https://user-images.githubusercontent.com/11630948/268075104-79d78c14-ea8a-4735-80ee-1c32ecddd73d.png)

### Different Callback Types

[](#different-callback-types)

You can define callbacks in different ways:

#### Anonymous Function

[](#anonymous-function)

```
$processCronJobs->add(
	'AnonymousFunctionCronJob',
	function(CronJob $cron){
		echo "Using anonymous function";
	}
);
```

#### Object Method

[](#object-method)

```
$processCronJobs->add(
	'ObjectMethodCronJob',
	[$this, 'myFunction']
);
```

#### Static Class Method

[](#static-class-method)

```
$processCronJobs->add(
	'StaticMethodCronJob',
	'\\ProcessWire\\MyClass::myStaticFunction'
);
```

The CronJob object
------------------

[](#the-cronjob-object)

OptionTypeDefaultDescription`name`StringUnique name in PascalCase e.g. `MyFirstCronJob`.`callback`Callable`function(CronJob $cron){}`Function to be executed. Can be an anonymous function, an array `[$object, 'methodName']`, or a static class method string `'\\ProcessWire\\MyClass::myStaticFunction'`.`lazyCron`null, String`null`If empty, the CronJob is executed without delay as soon as the path is called.`ns`null, String`null`If empty, the CronJob is called via the default path.`timing`Integer`CronJob::timingReady`The CronJon can be called either at onInit (1) or onReady (2). OnInit is earlier and therefore faster, but not all functions of ProcessWire are available here, e.g. page and language.`timingStr`String`onReady`This is just a getter property.`disabled`Boolean`false`This can be used to deactivate the cronjob, e.g. `disabled = $config->debug`.`trigger`Integer`CronJob::triggerNever`Displays the last trigger for execution. Possible values are:
`1` (Never): CronJob has never been executed
`2` (Auto): CronJob was last executed directly via the "real" Cron (onDemand).
`4` (Lazy): CronJob was called up with a time delay via the LazyCron.
`8` (Force): The CronJob was started manually
`16` (Error): The last call ended with an error (see log).`triggerStr`String`Unknown`This is just a getter property.`lastRun`Integer`0`Contains the last execution time as a Unix timestamp. Stored and retrieved in the ProcessWire cache.`lastError`StringPossible error message from the last call

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance25

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 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/61a0639a232837322b461271ef1775f769c3ff4e289141c9ee5bdcebc8f29835?d=identicon)[nr](/maintainers/nr)

---

Top Contributors

[![julianwinkel](https://avatars.githubusercontent.com/u/11630948?v=4)](https://github.com/julianwinkel "julianwinkel (13 commits)")

### Embed Badge

![Health badge](/badges/nr-processcronjobs/health.svg)

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

PHPackages © 2026

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