PHPackages                             ijvo/cronner - 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. ijvo/cronner

ActiveNette-addon

ijvo/cronner
============

Simple tool which helps with maintenance of cron tasks.

v3.1.0(1y ago)02.7k↓100%MITPHPPHP &gt;=7.1.0

Since Feb 21Pushed 1y ago1 watchersCompare

[ Source](https://github.com/IJVo/Cronner)[ Packagist](https://packagist.org/packages/ijvo/cronner)[ RSS](/packages/ijvo-cronner/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (11)Versions (27)Used By (0)

Cronner IJVo
============

[](#cronner-ijvo)

[![Build Status](https://camo.githubusercontent.com/70fbe79b8acd103044bc826a68955111c972cc8c0e0a12b1afe8bdc589b3d73f/68747470733a2f2f7472617669732d63692e6f72672f494a566f2f43726f6e6e65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/IJVo/Cronner)[![Latest stable](https://camo.githubusercontent.com/08d9bc7494e2477e094032b6ed4a7492f27ac3824478f4306b6cf07522b10997/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696a766f2f63726f6e6e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ijvo/cronner)[![License](https://camo.githubusercontent.com/b9ebbcbcf391a09438ac9db1742b7189056cb30dcaf36d3d605b24750cb7768e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f696a766f2f63726f6e6e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ijvo/cronner)

Simple tool which helps with maintenance of cron tasks. (forked from stekycz/Cronner)

- [Description](#description)
- [Usage](#usage)
- [Annotations](#annotations)
- [Author](#author)
- [License](#license)

Description
-----------

[](#description)

```
Use brackets in Nette 3

/**
 * @cronner-task(E-mail sending)
 * @cronner-period(1 day)
 */

```

Simple tool which helps with maintenance of cron tasks.

It requires **PHP &gt;= 7.1.0** and **Nette Framework &gt;= 3.0.0**.

Usage
-----

[](#usage)

It is very simple to use it because configuration is only in method annotations. Example class with tasks follows.

```
class CronTasks {
    /**
     * @cronner-task(E-mail sending)
     * @cronner-period(1 day)
     * @cronner-days(working days)
     * @cronner-time(23:30 - 05:00)
     */
    public function sendEmails() {
        // Code which sends all your e-mails
    }

    /**
     * @cronner-task(Important data replication)
     * @cronner-period(3 hours)
     */
    public function replicateImportantData() {
        // Replication code
    }
}
```

It is recommend to use compiler extension.

```
extension:
    cronner: stekycz\Cronner\DI\CronnerExtension

cronner:
    timestampStorage: stekycz\Cronner\TimestampStorage\FileStorage(%wwwDir%/../temp/cronner)
    maxExecutionTime: 1800
    criticalSectionTempDir: %wwwDir%/../temp/cronnerCritical
    criticalSectionDriver: null
```

It does not require any configuration however your own implementation of timestamp storage could be better then the default storage. Your storage must be defined as a service in `config.neon` and Cronner will find it. However you can specify service manually if it is not autowireable.

```
cronner:
    timestampStorage: @myCoolTimestampStorage
```

Or you can change the directory for default storage.

```
cronner:
    timestampStorage: stekycz\Cronner\TimestampStorage\FileStorage(%wwwDir%/../temp/cronner)
```

It is also possible to define `maxExecutionTime` for Cronner so you do not have make it by you own code (and probably for all your requests). Option `criticalSectionTempDir` can be change however the directory must be writable for php process. It is used to run each task only once at time.

At the end you would need to specify your task objects. It would be some service with high probability. You can add tag `cronner.tasks` to all services with Cronner tasks and those services will be bind automatically. However you can still add new task objects by your own using `addTasks` method.

Then you can use it very easily in `Presenter`

```
class CronPresenter extends \Nette\Application\UI\Presenter {
    /**
     * @var \stekycz\Cronner\Cronner
     * @inject
     */
    public $cronner;

    public function actionCron() {
        $this->cronner->run();
    }
}
```

or in `Command` from [Kdyby/Console](https://github.com/Kdyby/Console).

Service configuration is also possible but it **should not** be used using new versions of Nette because extension usage is recommended and preferable way. However you will still need to call `run` method somewhere in your `Presenter` or console `Command`.

```
services:
    cronner: stekycz\Cronner\Cronner(stekycz\Cronner\TimestampStorage\FileStorage(%wwwDir%/../temp/cronner))
    setup:
    	- addTasks(new CronTasks())
```

Annotations
-----------

[](#annotations)

### @cronner-task

[](#cronner-task)

This annotations is **required** for all public methods which should be used as a task. Its value is used as a name of task. If the value is missing the name is build from class name and method name.

If this annotation is single (for Cronner) in task method comment then the task is run every time when Cronner runs.

**Note:** Magic methods cannot be used as task (`__construct`, `__sleep`, etc.).

#### Example

[](#example)

```
/**
 * @cronner-task(Fetches all public data from all registered social networks)
 */
```

### @cronner-period

[](#cronner-period)

Not required but recommended annotation which specifies period of task execution. The period is minimal time between two executions of the task. It's value can be anything what is acceptable for `strtotime()` function. The only restriction is usability with "+" sign before the time because it is added by Cronner automatically. So `first day of this month`is not acceptable however `1 month` is acceptable.

**Attention!** The value of this annotation must not contain any sign (+ or -).

#### Example

[](#example-1)

```
/**
 * @cronner-period(1 day)
 */
```

### @cronner-days

[](#cronner-days)

Allows run the task only on specified days. Possible values are abbreviations of week day names. It means `Mon`, `Tue`, `Wed`, `Thu`, `Fri`, `Sat` and `Sun`. There are two shortcuts for easier usage: `working days` (`Mon`, `Tue`, `Wed`, `Thu`, `Fri`) and `weekend` (`Sat` and `Sun`) which are internally expanded to specific days. Multiple values must be separated by comma (`Mon, Wed, Fri`) or can be specified by range `Mon-Thu`.

#### Example

[](#example-2)

```
/**
 * @cronner-days(working days, Sun)
 */
```

### @cronner-time

[](#cronner-time)

Specifies day time range (or ranges) in which the task can be run. It can be range or a specific minute. It uses 24 hour time model. Multiple values must be separated by comma.

The time can be defined over midnight as it is in following example.

**Note:** There is tolerance time of 5 seconds to run task as soon as possible if previous run have had slower start from any reason.

#### Example

[](#example-3)

```
/**
 * @cronner-time(11:00, 23:30 - 05:00)
 */
```

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance41

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 90.4% 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 ~205 days

Recently: every ~450 days

Total

22

Last Release

517d ago

Major Versions

0.8.0 → v1.0.02014-08-17

v1.1.2 → v2.0.02017-02-01

v2.2.0 → v3.0.02019-12-30

v2.3.0 → v3.0.42023-12-09

PHP version history (4 changes)0.5.0PHP &gt;=5.3.0

0.8.0PHP &gt;=5.3.3

v2.0.0PHP &gt;=7.0.0

v2.3.0PHP &gt;=7.1.0

### Community

Maintainers

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

---

Top Contributors

[![stekycz](https://avatars.githubusercontent.com/u/865447?v=4)](https://github.com/stekycz "stekycz (208 commits)")[![IJVo](https://avatars.githubusercontent.com/u/18380028?v=4)](https://github.com/IJVo "IJVo (10 commits)")[![trejjam](https://avatars.githubusercontent.com/u/3594540?v=4)](https://github.com/trejjam "trejjam (4 commits)")[![Koricz](https://avatars.githubusercontent.com/u/11611623?v=4)](https://github.com/Koricz "Koricz (2 commits)")[![duskohu](https://avatars.githubusercontent.com/u/3354466?v=4)](https://github.com/duskohu "duskohu (2 commits)")[![konecnyjakub](https://avatars.githubusercontent.com/u/392116?v=4)](https://github.com/konecnyjakub "konecnyjakub (2 commits)")[![norbe](https://avatars.githubusercontent.com/u/194486?v=4)](https://github.com/norbe "norbe (1 commits)")[![brabijan](https://avatars.githubusercontent.com/u/2448709?v=4)](https://github.com/brabijan "brabijan (1 commits)")

---

Tags

nettecronmanagertask

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ijvo-cronner/health.svg)

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

###  Alternatives

[bileto/cronner

Simple tool which helps with maintenance of cron tasks.

752.1k](/packages/bileto-cronner)[nette/web-project

Nette: Standard Web Project

10991.8k](/packages/nette-web-project)

PHPackages © 2026

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