PHPackages                             bpetheo/yii2-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. [CLI &amp; Console](/categories/cli)
4. /
5. bpetheo/yii2-cron

ActiveYii2-extension[CLI &amp; Console](/categories/cli)

bpetheo/yii2-cron
=================

Cron implementation for yii2 framework. Executes scheduled commands defined in yii config.

1.0.7(8y ago)78221[1 PRs](https://github.com/bpetheo/yii2-cron/pulls)GPL-3.0PHP

Since Jan 9Pushed 8y ago2 watchersCompare

[ Source](https://github.com/bpetheo/yii2-cron)[ Packagist](https://packagist.org/packages/bpetheo/yii2-cron)[ RSS](/packages/bpetheo-yii2-cron/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)Dependencies (1)Versions (9)Used By (0)

yii2-cron
=========

[](#yii2-cron)

Cron implementation for yii2 framework. Executes scheduled commands defined in yii config. So if you need to add/remove or reschedule a cron job you only need to modify and deploy the config file, no fiddling with crontab or other actions required. Handy if you are deploying many apps and/or deploy to multiple servers. Only requires server side scripts installed once and it is ready to use. The server side scripts can handle multiple projects (including automatic discovery of added/removed repos). They can be found here:

You can also assign tags to jobs, so if you use the same config file on multiple servers you can still have different cron jobs running (or the same jobs with different timings)

The component does some basic logging to runtime/logs/{command}.{action}.{date}.log

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

[](#installation)

Get via composer: `composer require bpetheo/yii2-cron ~1.0.0`

Add to the controller map in config/console.php:

```
'controllerMap' => [
    // ...
    'cron' => [
        'class' => 'bpetheo\yii2cron\CronController',
        'defaultAction' => 'run',
    ],
],

```

Configuration
-------------

[](#configuration)

When setting up timing values you can use the standard cron syntax elements (`*`, `*/5`, `15`, `0,30`). The command should be the command/action arguments of ./yii. For example if you would set `/path_to_project/yii hello/index` in the standard cron tab the command in config you want to use will be `hello/index`.

Full configuration block looks like this:

```
'params' => [
        // other parameters...
        'cronTab' => [
            // run hello/index command every 5 minutes on 21th septermber and
            // 21th december in default and dev environment
            'Sample cronjob - full config' => [
                'enabled' => true,
                'command'=>'hello/index',
                'timing' => [
                    'min' => '*/5',
                    'hour' => '*',
                    'day' => '21',
                    'month' => '9,12',
                    'dayofweek' => '*',
                ],
                'tags' => [
                    'default',
                    'development',
                ],
            ],
        // other parameters...
    ],

```

You can also use a simplified format by setting only the parameters differing from defaults:

```
'params' => [
        // other parameters...
        'cronTab' => [
            // execute hello/index every 30 minuted
            // short form, only non-default values are set explicitly
            'Sample cronjob - short config' => [
                'enabled' => true,
                'command'=>'hello',
                'timing' => [
                    'min' => '0,30',
                ],
            ],
        ],
        // other parameters...
    ],

```

Only `command` parameter required. Also simple string format like `* * * * * controller/action` avalible.

```
'params' => [
        // other parameters...
        'cronTab' => [
            // both cron jobs controller/action1 and controller/action2
            // valid and runs every minute
            [
                'command'=>'controller/action1',
            ],
            '* * * * * controller/action2',
        ],
        // other parameters...
    ],

```

Contributing
------------

[](#contributing)

I've made this project to fit my own needs. You might have different use cases which is not covered, but feel free to extend or modify the code to make it suitable to more people.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~28 days

Recently: every ~47 days

Total

8

Last Release

3261d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8666715?v=4)[Petheő Bence](/maintainers/bpetheo)[@bpetheo](https://github.com/bpetheo)

---

Top Contributors

[![bpetheo](https://avatars.githubusercontent.com/u/8666715?v=4)](https://github.com/bpetheo "bpetheo (4 commits)")[![igor-netFantom](https://avatars.githubusercontent.com/u/26833529?v=4)](https://github.com/igor-netFantom "igor-netFantom (4 commits)")

---

Tags

cronyii2extensionyii2 cronyii2cron

### Embed Badge

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

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[samdark/yii2-webshell

A web shell that allows to run yii console commands and create your own commands.

22585.3k2](/packages/samdark-yii2-webshell)[fedemotta/yii2-cronjob

Yii2 extension to help in the creation of automated console scripts

2233.9k](/packages/fedemotta-yii2-cronjob)[toriphes/yii2-console-runner

Runs console command in yii web application

29248.0k](/packages/toriphes-yii2-console-runner)[trntv/yii2-tactician

A simple, flexible command bus. This package provide it's integration with Yii2

1459.2k](/packages/trntv-yii2-tactician)

PHPackages © 2026

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