PHPackages                             m-h-1/cron-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. m-h-1/cron-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

m-h-1/cron-bundle
=================

v1.3.0(4y ago)04.6k1MITPHPPHP ^7.1|^8.0

Since Oct 5Pushed 4y ago2 watchersCompare

[ Source](https://github.com/m-h-1/cron-bundle)[ Packagist](https://packagist.org/packages/m-h-1/cron-bundle)[ RSS](/packages/m-h-1-cron-bundle/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (3)Dependencies (12)Versions (6)Used By (0)

[![CI](https://github.com/m-h-1/cron-bundle/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/m-h-1/cron-bundle/actions/workflows/ci.yml)[![coverage](./docs/coverage_badge.svg)](./docs/coverage_badge.svg)

cron-bundle
===========

[](#cron-bundle)

Simple Symfony bundle to schedule commands. Uses [symfony/lock](https://symfony.com/doc/current/components/lock.html) to make sure a specific command can't run more than once at the same time. Different commands are executed in parallel.

TOC
---

[](#toc)

- [Usage](#usage)
    - [Register new job](#register-new-job)
    - [Execute jobs](#execute-jobs)
    - [Stalled job executions](#stalled-job-executions)
- [Installation](#installation)
    - [Step 1: Download the bundle](#step-1-download-the-bundle)
    - [Step 2: Enable the bundle](#step-2-enable-the-bundle)
    - [Step 3: Create DB tables](#step-3-create-db-tables)
    - [Step 4: Add to crontab](#step-4-add-to-crontab)
- [Config](#config)

Usage
-----

[](#usage)

### Register new job

[](#register-new-job)

Simply register a new job by creating a new entry in `mh1_cron_job`.

```
INSERT INTO mh1_cron_job (id, title, description, command, enabled, schedule, execute_stalled)
VALUES ('d63a6a70-0b56-4b0d-bdfb-06e4c7e7a2eb', 'Symfony Help Command', 'display the Symfony help', 'help', 1, '*/15 * * * *', 1);
```

FieldNameDescription`id`uuidv4`title`Title of the command`description`Optional description`command`Executable Symfony command name`enabled`TRUE/1 if job should be enabled for execution, otherwise FALSE/0`schedule`Crontab style schedule [help](https://crontab.guru/)`execute_stalled`[see](#stalled-job-executions)### Execute jobs

[](#execute-jobs)

```
$ bin/console mh1:cron:run
```

### Stalled job executions

[](#stalled-job-executions)

**This only works for jobs that ran at least once in the past!**

The Doctrine integration also provides the possibility to execute stalled jobs.

A stalled job is a job that was supposed to be executed at a specific time but was not executed due to being temporarily disabled or `bin/console mh1:cron:run` was not run, but should be run once the job is enabled again.

For example, you have a job that runs every night at 1 AM, but for some reason (e.g. server maintenance) the jobs are not executed between 0:30 AM and 3 AM. If `executeStalled` (`execute_stalled` DB column) is set to true, the job will be executed after the maintenance window at 3 AM.

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

[](#installation)

### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

```
$ composer require m-h-1/cron-bundle
```

### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

```
// config/bundles.php

return [
    // ...
    MH1\CronBundle\MH1CronBundle::class => ['all' => true],
];
```

### Step 3: Create DB Tables

[](#step-3-create-db-tables)

Create tables for the Doctrine entities:

#### DoctrineMigrations

[](#doctrinemigrations)

```
$ bin/console doctrine:migrations:diff
$ bin/console doctrine:migrations:migrate
```

#### raw SQL

[](#raw-sql)

```
CREATE TABLE mh1_cron_job
(
    id              CHAR(36)     NOT NULL PRIMARY KEY,
    title           VARCHAR(255) NOT NULL,
    description     VARCHAR(255) NULL,
    command         VARCHAR(255) NOT NULL,
    enabled         TINYINT(1)   NOT NULL,
    schedule        VARCHAR(255) NOT NULL,
    execute_stalled TINYINT(1)   NOT NULL
) COLLATE = utf8mb4_unicode_ci;

CREATE TABLE mh1_cron_job_report
(
    id          INT AUTO_INCREMENT PRIMARY KEY,
    cron_job_id CHAR(36) NOT NULL,
    start_time  DATETIME NOT NULL,
    end_time    DATETIME NULL,
    exit_code   INT      NULL,
    output      LONGTEXT NULL,
    duration    INT      NULL,
    CONSTRAINT fk_a297993479099ed8 FOREIGN KEY (cron_job_id) REFERENCES mh1_cron_job (id)
) COLLATE = utf8mb4_unicode_ci;

CREATE INDEX idx_a297993479099ed8 ON mh1_cron_job_report (cron_job_id);
```

### Step 4: Add to crontab

[](#step-4-add-to-crontab)

Add the command to crontab and replace PATH\_TO\_APPLICATION with the path to your Symfony project directory.

```
* * * * *   PATH_TO_APPLICATION/bin/console mh1:cron:run
```

Config
------

[](#config)

```
# config/packages/mh1_cron.yaml
mh1_cron:
    service: null # override job service with a custom service
    log_service: null # override logging service
    check_interval: 1000 # milliseconds to wait between the checks if a process is running (must be greater than 1)
    execution_time_zone: null # use a custom time zone for job scheduling, the default is the PHP default timezone
    lock_prefix: '' # use a prefix for cronjob logging, the default is empty string
    php_executable_path: null # use a custom path to php executable. e.g. /usr/local/php81/bin/php
```

#### Custom job service

[](#custom-job-service)

```
# config/packages/mh1_cron.yaml
mh1_cron:
    service: App\Service\CustomCronJobService
```

#### Different logging service

[](#different-logging-service)

```
# config/packages/mh1_cron.yaml
mh1_cron:
    log_service: App\Service\CustomLogService
```

#### Wait half a second (instead of one second) between the checkRunning calls

[](#wait-half-a-second-instead-of-one-second-between-the-checkrunning-calls)

```
# config/packages/mh1_cron.yaml
mh1_cron:
    check_interval: 500
```

#### Use a custom time zone to check for due time

[](#use-a-custom-time-zone-to-check-for-due-time)

Every PHP supported timezone string is valid

```
# config/packages/mh1_cron.yaml
mh1_cron:
    execution_time_zone: 'UTC'
```

```
# config/packages/mh1_cron.yaml
mh1_cron:
    execution_time_zone: 'Europe/Berlin'
```

#### Prefix lock name

[](#prefix-lock-name)

The symfony lock component uses the commands name (`app:run`) as the name for the lock.

If you want to run the same command in different deployments or folders on the same system you have to use this parameter to prefix the name of the locks, e.g. `instance1:app:run`, `instance2:app:run`.

```
# config/packages/mh1_cron.yaml
mh1_cron:
    lock_prefix: 'second_instance'
```

#### Use a custom path to php executable

[](#use-a-custom-path-to-php-executable)

```
# config/packages/mh1_cron.yaml
mh1_cron:
    php_executable_path: '/usr/local/php81/bin/php'
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90% 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 ~18 days

Total

5

Last Release

1604d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c6e9448a3407a9c3e736cb6d3417dc1805b40773674f6f5a1a026f0dad43b5ec?d=identicon)[m-h-1](/maintainers/m-h-1)

---

Top Contributors

[![m-h-1](https://avatars.githubusercontent.com/u/60962650?v=4)](https://github.com/m-h-1 "m-h-1 (9 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

###  Code Quality

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/m-h-1-cron-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/m-h-1-cron-bundle/health.svg)](https://phpackages.com/packages/m-h-1-cron-bundle)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

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

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

8.4k5.6M647](/packages/sylius-sylius)[sulu/sulu

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

1.3k1.3M151](/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)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M385](/packages/shopware-core)

PHPackages © 2026

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