PHPackages                             stekycz/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. stekycz/cronner

Abandoned → [bileto/cronner](/?search=bileto%2Fcronner)Nette-addon[Utility &amp; Helpers](/categories/utility)

stekycz/cronner
===============

Simple tool which helps with maintenance of cron tasks.

v3.0.0(4y ago)7569.8k18[2 issues](https://github.com/bileto/cronner/issues)[3 PRs](https://github.com/bileto/cronner/pulls)MITPHPPHP &gt;=7.1.0

Since Feb 21Pushed 3y ago9 watchersCompare

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

READMEChangelog (10)Dependencies (11)Versions (21)Used By (0)

Cronner [![PHP Composer](https://github.com/bileto/cronner/actions/workflows/php.yml/badge.svg)](https://github.com/bileto/cronner/actions/workflows/php.yml)
=============================================================================================================================================================

[](#cronner-)

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

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

[](#description)

Simple tool which helps with maintenance of cron tasks.

It requires **PHP &gt;= 8.0** and **Nette Framework &gt;= 3.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(): void
    {
        // Code which sends all your e-mails
    }

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

It is recommend to use compiler extension.

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

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: Bileto\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 \Bileto\Cronner\Cronner
     * @inject
     */
    public $cronner;

    public function actionCron(): void
    {
        $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: Bileto\Cronner\Cronner(Bileto\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

41

—

FairBetter than 89% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity42

Moderate usage in the ecosystem

Community24

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 76.2% 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 ~201 days

Recently: every ~422 days

Total

17

Last Release

1606d ago

Major Versions

0.8.0 → v1.0.02014-08-17

v1.1.2 → v2.0.02017-02-01

v2.3.0 → v3.0.02021-12-25

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/4ef9d9b4f18ff559cf0dfecccd8593840b04c26c09a95a396d8cdab865aba127?d=identicon)[bileto](/maintainers/bileto)

---

Top Contributors

[![stekycz](https://avatars.githubusercontent.com/u/865447?v=4)](https://github.com/stekycz "stekycz (208 commits)")[![jspetrak](https://avatars.githubusercontent.com/u/146057?v=4)](https://github.com/jspetrak "jspetrak (27 commits)")[![janbarasek](https://avatars.githubusercontent.com/u/4738758?v=4)](https://github.com/janbarasek "janbarasek (14 commits)")[![trejjam](https://avatars.githubusercontent.com/u/3594540?v=4)](https://github.com/trejjam "trejjam (4 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (3 commits)")[![radekrepka](https://avatars.githubusercontent.com/u/28730076?v=4)](https://github.com/radekrepka "radekrepka (3 commits)")[![konecnyjakub](https://avatars.githubusercontent.com/u/392116?v=4)](https://github.com/konecnyjakub "konecnyjakub (2 commits)")[![duskohu](https://avatars.githubusercontent.com/u/3354466?v=4)](https://github.com/duskohu "duskohu (2 commits)")[![Koricz](https://avatars.githubusercontent.com/u/11611623?v=4)](https://github.com/Koricz "Koricz (2 commits)")[![northys](https://avatars.githubusercontent.com/u/2878126?v=4)](https://github.com/northys "northys (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)")[![grogy](https://avatars.githubusercontent.com/u/1322983?v=4)](https://github.com/grogy "grogy (1 commits)")

---

Tags

nettecronmanagertask

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[bileto/cronner

Simple tool which helps with maintenance of cron tasks.

752.1k](/packages/bileto-cronner)[nette/php-generator

🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 8.5 features.

2.3k64.2M576](/packages/nette-php-generator)[contributte/di

Extra contrib to nette/di

465.8M18](/packages/contributte-di)[rewieer/taskschedulerbundle

Task Scheduler with CRON for Symfony

63242.1k](/packages/rewieer-taskschedulerbundle)[contributte/menu-control

Menu control for Nette framework

29108.6k1](/packages/contributte-menu-control)[ttree/scheduler

Simple task scheduler for Neos Flow Framework

21108.8k1](/packages/ttree-scheduler)

PHPackages © 2026

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