PHPackages                             t4web/cron - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. t4web/cron

ActiveLibrary[Queues &amp; Workers](/categories/queues)

t4web/cron
==========

ZF2 Module. A PHP cron task manager for ZF2 Application

1.0.0(10y ago)36.5k—0%1[1 issues](https://github.com/t4web/Cron/issues)BSD-3-ClausePHPPHP ^5.5 || ^7.0

Since Mar 11Pushed 9y ago3 watchersCompare

[ Source](https://github.com/t4web/Cron)[ Packagist](https://packagist.org/packages/t4web/cron)[ Docs](https://github.com/t4web/Cron)[ RSS](/packages/t4web-cron/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (11)Versions (2)Used By (0)

[![Build Status](https://camo.githubusercontent.com/4bc2b26aee5284655caf39309ae08388da016e7ded6795edc937a9c7ea77f027/68747470733a2f2f7472617669732d63692e6f72672f74347765622f43726f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/t4web/Cron)[![codecov.io](https://camo.githubusercontent.com/3c0201025810f8d41661c84856e9e61a45069f95eea1c1ec98ae1c8ca8ce40e3/687474703a2f2f636f6465636f762e696f2f6769746875622f74347765622f43726f6e2f636f7665726167652e7376673f6272616e63683d6d6173746572)](http://codecov.io/github/t4web/Cron?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6b099c26bd1a88332861554f32be21974265d188e6255729a36195d0036747fe/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f74347765622f43726f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/t4web/Cron/?branch=master)

Cron
====

[](#cron)

ZF2 Module. A PHP cron task manager for ZF2 Application. Inspired by [Cron/Cron](https://github.com/Cron/Cron)

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

[](#installation)

Installation of Cron Module uses composer.

```
php composer.phar require t4web/cron
```

or add to your composer.json

```
"require": {
  "t4web/cron": "^1.0.0"
}
```

Then add `T4web\Cron` to your `config/application.config.php`

### Configuration

[](#configuration)

Add to your configuration:

```
'cron' => [
    'log-directory' => 'data', // default: getcwd()/data
    'phpPath'    => 'php', // default: php
    'scriptPath' => '/path/to/application/public/folder/', // default: getcwd()/public/
    'jobs'       => [
        [
            'id' => 'cron-job1',
            'command'  => 'index.php application cron-job1',
            'schedule' => '* * * * *'
        ],
        [
            'id' => 'cron-job2',
            'command'  => 'index.php application cron-job2',
            'schedule' => '* * * * *'
        ]
    ],
    'timeout' => 3600 // default: null (without timeout)
]
```

General options:

OptionDescriptionlog-directory**(not required)** path to the log files, no required, but if empty - directory `data` must be writablephpPath**(not required)** path to the php executable, usually "php"scriptPath**(not required)** path to your applications public folder, defaults to your root application public folderjobsan array of jobs and their schedulestimeout**(not required)** timeout for the cron job (in seconds)Options for cron jobs:

OptionDescriptionid**(required)** job identificator - for grouping job reportscommand**(required)** the php script command to be runschedule**(required)** A valid [Cron schedule](https://en.wikipedia.org/wiki/Cron)#### Run cron job from command line

[](#run-cron-job-from-command-line)

We recommend add this command to cron with run every minute (\* \* \* \* \*)

```
php index.php cron run
```

### Logs

[](#logs)

Logs works with [T4web\\EventSubscriber](https://github.com/t4web/EventSubscriber) module (this module provide one place for manage all application events). Install and enable `T4web\EventSubscriber` in your application config. If module `T4web\EventSubscriber` does not exists - logs will not be written.

After run in `log-directory` will be created log file by pattern `JOB-ID.log` (example: data/cron-job1.log) with content like this:

```
[2016-02-25 15:43:48] Job fail
  Start: 2016-02-25 15:43:47
  End: 2016-02-25 15:43:48
  Execution time: 1 seconds
--Output:
1
2
3

--End output.
--Error:
PHP Fatal error:  Call to undefined function Application\Controller\asd() in /storage/proj/1season/module/Application/src/Application/Controller/CronController.php on line 21
PHP Stack trace:
PHP   1. {main}() /storage/proj/1season/public/index.php:0
PHP   2. Zend\Mvc\Application->run() /storage/proj/1season/public/index.php:21
PHP   3. Zend\EventManager\EventManager->trigger() /storage/proj/1season/vendor/zendframework/zend-mvc/src/Application.php:314
PHP   4. Zend\EventManager\EventManager->triggerListeners() /storage/proj/1season/vendor/zendframework/zend-eventmanager/src/EventManager.php:214
PHP   5. call_user_func:{/storage/proj/1season/vendor/zendframework/zend-eventmanager/src/EventManager.php:490}() /storage/proj/1season/vendor/zendframework/zend-eventmanager/src/EventManager.php:490
PHP   6. Zend\Mvc\DispatchListener->onDispatch() /storage/proj/1season/vendor/zendframework/zend-eventmanager/src/EventManager.php:490
PHP   7. Zend\Mvc\Controller\AbstractController->dispatch() /storage/proj/1season/vendor/zendframework/zend-mvc/src/DispatchListener.php:93
PHP   8. Zend\EventManager\EventManager->trigger() /storage/proj/1season/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php:118
PHP   9. Zend\EventManager\EventManager->triggerListeners() /storage/proj/1season/vendor/zendframework/zend-eventmanager/src/EventManager.php:214
PHP  10. call_user_func:{/storage/proj/1season/vendor/zendframework/zend-eventmanager/src/EventManager.php:490}() /storage/proj/1season/vendor/zendframework/zend-eventmanager/src/EventManager.php:490
PHP  11. Zend\Mvc\Controller\AbstractActionController->onDispatch() /storage/proj/1season/vendor/zendframework/zend-eventmanager/src/EventManager.php:490
PHP  12. Application\Controller\CronController->job1Action() /storage/proj/1season/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php:82

--End error.

```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3720d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9d6b9ab1c535f3a27bd3b2bb97bc7d43c611cb69731861d2c2d60e1174b27ec4?d=identicon)[maxgu](/maintainers/maxgu)

---

Top Contributors

[![maxgu](https://avatars.githubusercontent.com/u/208688?v=4)](https://github.com/maxgu "maxgu (27 commits)")

---

Tags

cronzf2zf2 module

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/t4web-cron/health.svg)

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

###  Alternatives

[socalnick/scn-social-auth

Uses the HybridAuth PHP library to Enable authentication via Google, Facebook, Twitter, Yahoo!, etc for the ZfcUser ZF2 module.

21974.2k3](/packages/socalnick-scn-social-auth)[stroker/cache

Provides a full page cache solution for Laminas

6444.7k](/packages/stroker-cache)[snapshotpl/zf-snap-php-debug-bar

PHP Debug Bar module for Zend Framework 2

3026.1k](/packages/snapshotpl-zf-snap-php-debug-bar)[mamuz/mamuz-blog

Provides blog feature for ZF2 with Doctrine

101.1k1](/packages/mamuz-mamuz-blog)

PHPackages © 2026

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