PHPackages                             phuongdev89/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. phuongdev89/yii2-cron

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

phuongdev89/yii2-cron
=====================

Auto block|unblock console command for the Yii2. One command without duplicate.

12151PHP

Since Jan 19Pushed 2y agoCompare

[ Source](https://github.com/phuongdev89/yii2-cron)[ Packagist](https://packagist.org/packages/phuongdev89/yii2-cron)[ RSS](/packages/phuongdev89-yii2-cron/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (1)

Yii Cron extension
==================

[](#yii-cron-extension)

[![Latest Stable Version](https://camo.githubusercontent.com/97809040f2758c78665aa6e2929838d56e20546c4751fbf0ace5fcc5eea8108e/68747470733a2f2f706f7365722e707567782e6f72672f7068756f6e6764657638392f796969322d63726f6e2f762f737461626c65)](https://packagist.org/packages/phuongdev89/yii2-cron) [![Total Downloads](https://camo.githubusercontent.com/61dc6aa50d13b28628a1c5f97df9898405751ecae20786f70a978c78be9bd1a8/68747470733a2f2f706f7365722e707567782e6f72672f7068756f6e6764657638392f796969322d63726f6e2f646f776e6c6f616473)](https://packagist.org/packages/phuongdev89/yii2-cron)

Provide a logic and functionality to block console commands until they execute. Unlocks commands exhibited at the expiration of the block if the server is down.

Install
-------

[](#install)

```
composer require phuongdev89/yii2-cron

```

Usage
-----

[](#usage)

### Code

[](#code)

Any command can be converted to daemon

```
class AwesomeController extends \phuongdev89\cron\commands\DaemonController
{
    public $restartDb = false; //restart db connection every run, default is `false`

    public $db = 'db'; //name of db component need to restart, `db` that mean `Yii::$app->db`, default is `db`

    public $daemonDelay = 15; //delay time between run, in microsecond, default is `15`

    /**
     * Daemon name, unique
     *
     * @return string
     */
    protected function daemonName(): string
    {
        return 'mail-queue';
    }

    /**
     * repeatable function
     */
    public function worker()
    {
        // Some logic that will be repeateble
    }
}
```

### Command

[](#command)

Start repeat function

```
php yii awesome/start

```

Stop repeat function

```
php yii awesome/stop

```

Restart repeat function

```
php yii awesome/restart

```

Add to crontab:

```
* * * * * php yii awsome/start

```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity20

Early-stage or recently created project

 Bus Factor1

Top contributor holds 66.7% 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.

### Community

Maintainers

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

---

Top Contributors

[![lexxorlov](https://avatars.githubusercontent.com/u/7910574?v=4)](https://github.com/lexxorlov "lexxorlov (6 commits)")[![phuongdev89](https://avatars.githubusercontent.com/u/7648033?v=4)](https://github.com/phuongdev89 "phuongdev89 (2 commits)")[![orlov-alexey](https://avatars.githubusercontent.com/u/95412821?v=4)](https://github.com/orlov-alexey "orlov-alexey (1 commits)")

### Embed Badge

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

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

###  Alternatives

[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24726.4M22](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

13045.3M6.2k](/packages/illuminate-console)

PHPackages © 2026

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