PHPackages                             mybuilder/cronos-bundle - 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. mybuilder/cronos-bundle

ActiveSymfony-bundle[CLI &amp; Console](/categories/cli)

mybuilder/cronos-bundle
=======================

Symfony 4/5/6 bundle which allows you to use @Cron annotations to configure cron to run your console commands.

4.0.0(3y ago)89486.1k↓33.7%17[5 PRs](https://github.com/mybuilder/cronos-bundle/pulls)1MITPHPPHP &gt;=8.0.2

Since Oct 23Pushed 2y ago13 watchersCompare

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

READMEChangelog (10)Dependencies (10)Versions (23)Used By (1)

Cronos Bundle
=============

[](#cronos-bundle)

A bundle for Symfony 4/5/6 that allows you to use `@Cron` annotations to configure when cron should run your console commands.

Uses the [Cronos](https://github.com/mybuilder/cronos) library to do the actual output and updating.

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

[](#installation)

### Install with composer

[](#install-with-composer)

Run the composer require command:

```
$ composer require mybuilder/cronos-bundle
```

### Enable the bundle

[](#enable-the-bundle)

If you do not use Symfony Flex, enable the bundle in the `config/bundles.php` for Symfony 4/5/6:

```
return [
    MyBuilder\Bundle\CronosBundle\MyBuilderCronosBundle::class => ['all' => true],
];
```

### Configure the bundle

[](#configure-the-bundle)

You can add the following to your `config/packages/my_builder_cronos.yaml` (Symfony 4/5/6) to configure the package.

```
my_builder_cronos:
    exporter:
        key: unique-key
        mailto: cron@example.com
        path: /bin:/usr/local/bin
        executor: php
        console: bin/console
        shell: /bin/bash
```

optiondescriptionkeyUnique key that wraps all the cron configured for the current application.mailtoSets the default email address for all cron output to go to.pathSets the path for all commands in the crontab it works just like the shell PATH, but it does not inherit from your environment. That means you cannot use ~ or other shell expansions.executorAllows you to specify a program that all commands should be passed to such as `/usr/local/bin/php`.consoleAllows you to specify the console that all commands should be passed to such as `bin/console`.shellAllows you to specify which shell each program should be run with.Usage
-----

[](#usage)

The first step is to add the use case for the annotation to the top of the command you want to use the @Cron annotations in.

```
use MyBuilder\Bundle\CronosBundle\Annotation\Cron;
```

Then add to the phpdoc for the command class the '@Cron' annotation which tells cron when you want it to run. This example says it should be run on the web server, every 5 minutes, and we don't want to log any output.

```
/**
 * Command for sending our email messages from the database.
 *
 * @Cron(minute="/5", noLogs=true, server="web")
 */
class SendQueuedEmailsCommand extends Command {}
```

### Specifying when to run

[](#specifying-when-to-run)

The whole point of cron is being able to specify when a script is run therefore there are a lot of options.

You should read the [general cron info](https://en.wikipedia.org/wiki/Cron) for a general idea of cron and what you can use in these time fields.

**Please note** You CANNOT use `*/` in the annotations, if you want `*/5` just put `/5` and [Cronos](https://github.com/mybuilder/cronos) will automatically change it to `*/5`.

### Annotation examples

[](#annotation-examples)

annotationdescription`@Cron(minute="/5")`Every 5 minutes`@Cron(minute="5")`At the 5th minute of each hour`@Cron(minute="5", hour="8")`5 minutes past 8am every day`@Cron(minute="5", hour="8", dayOfWeek="0")`5 minutes past 8am every Sunday`@Cron(minute="5", hour="8", dayOfMonth="1")`5 minutes past 8am on first of each month`@Cron(minute="5", hour="8", dayOfMonth="1", month="1")`5 minutes past 8am on first of of January`@Cron(minute="/5", params="--user=barman")`Every 5 minutes, with a custom paramBuilding the cron
-----------------

[](#building-the-cron)

You should run `bin/console cronos:dump` and review what the cron file would look after it has been updated. If everything looks ok you can replace your crontab by running the command below.

`bin/console cronos:replace`

You can also limit which commands are included in the cron file by specifying a server, and it will then only show commands which are specified for that server.

### Exporting the cron

[](#exporting-the-cron)

```
bin/console cronos:dump --server=web
bin/console cronos:replace --server=web

```

### Environment

[](#environment)

You can choose which environment you want to run the commands in cron under like this.

`bin/console cronos:replace --server=web --env=prod`

Troubleshooting
---------------

[](#troubleshooting)

- When a cron line is executed it is executed with the user that owns the crontab, but it will not execute any of the users default shell files so all paths etc need to be specified in the command called from the cron line.
- Your crontab will not be executed if you do not have usable shell in `/etc/passwd`
- If your jobs don't seem to be running check the cron daemon is running, also check your username is in `/etc/cron.allow` and not in `/etc/cron.deny`.
- Environmental substitutions do not work, you cannot use things like `$PATH`, `$HOME`, or `~/sbin`.

---

Created by [MyBuilder](https://www.mybuilder.com/) - Check out our [blog](https://tech.mybuilder.com/) for more insight into this and other open-source projects we release.

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity51

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

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

Recently: every ~243 days

Total

22

Last Release

1228d ago

Major Versions

v0.9.2 → v1.0.02014-07-01

1.0.3 → 2.0.02016-06-24

2.1.1 → 3.0.22020-05-05

3.2.0 → 4.0.02023-01-06

PHP version history (5 changes)v0.8.0PHP &gt;=5.3.3

2.0.0PHP &gt;=5.6.0

2.1.0PHP &gt;=7.1

3.0.2PHP &gt;=7.3

4.0.0PHP &gt;=8.0.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/7441f1c0c4066b13108d5a5381fac0c548008328a90b7a55b6e5b00ef95a4c92?d=identicon)[mybuilder](/maintainers/mybuilder)

---

Top Contributors

[![gavinlove](https://avatars.githubusercontent.com/u/308682?v=4)](https://github.com/gavinlove "gavinlove (24 commits)")[![keyvanakbary](https://avatars.githubusercontent.com/u/717129?v=4)](https://github.com/keyvanakbary "keyvanakbary (15 commits)")[![maxbaldanza](https://avatars.githubusercontent.com/u/2786820?v=4)](https://github.com/maxbaldanza "maxbaldanza (9 commits)")[![angelsk](https://avatars.githubusercontent.com/u/606510?v=4)](https://github.com/angelsk "angelsk (7 commits)")[![seferov](https://avatars.githubusercontent.com/u/1233843?v=4)](https://github.com/seferov "seferov (7 commits)")[![Chris8934](https://avatars.githubusercontent.com/u/44963939?v=4)](https://github.com/Chris8934 "Chris8934 (5 commits)")[![Chris53897](https://avatars.githubusercontent.com/u/7104259?v=4)](https://github.com/Chris53897 "Chris53897 (5 commits)")[![voronkovich](https://avatars.githubusercontent.com/u/2299535?v=4)](https://github.com/voronkovich "voronkovich (3 commits)")[![rainerkraftmb](https://avatars.githubusercontent.com/u/11923165?v=4)](https://github.com/rainerkraftmb "rainerkraftmb (3 commits)")[![CyExy](https://avatars.githubusercontent.com/u/179921?v=4)](https://github.com/CyExy "CyExy (2 commits)")[![eddmann](https://avatars.githubusercontent.com/u/801020?v=4)](https://github.com/eddmann "eddmann (1 commits)")[![adrenalinkin](https://avatars.githubusercontent.com/u/4967813?v=4)](https://github.com/adrenalinkin "adrenalinkin (1 commits)")[![kimmelserj](https://avatars.githubusercontent.com/u/6247525?v=4)](https://github.com/kimmelserj "kimmelserj (1 commits)")

---

Tags

bundlecronphpsymfonysymfony-bundlecroncronos

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mybuilder-cronos-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/mybuilder-cronos-bundle/health.svg)](https://phpackages.com/packages/mybuilder-cronos-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k12.4M193](/packages/simplesamlphp-simplesamlphp)

PHPackages © 2026

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