PHPackages                             hossein142001/yii2-cronjob - 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. hossein142001/yii2-cronjob

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

hossein142001/yii2-cronjob
==========================

Yii2 extension to help in the creation of automated console scripts

2.1(6y ago)02261MITPHP

Since Oct 7Pushed 6y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (1)Versions (5)Used By (0)

Yii2 Cron Job
=============

[](#yii2-cron-job)

[![Latest Stable Version](https://camo.githubusercontent.com/3eb71b5dca6e994e15fa82dc32eab28eabf74d71808876fb3afda1750db67d46/68747470733a2f2f706f7365722e707567782e6f72672f666564656d6f7474612f796969322d63726f6e6a6f622f762f737461626c65)](https://packagist.org/packages/fedemotta/yii2-cronjob) [![Total Downloads](https://camo.githubusercontent.com/ceb8ae2c0f8c7a06625da503df81f0dc400c6c68ed990f7c29cf89f60ea35e6a/68747470733a2f2f706f7365722e707567782e6f72672f666564656d6f7474612f796969322d63726f6e6a6f622f646f776e6c6f616473)](https://packagist.org/packages/fedemotta/yii2-cronjob) [![Latest Unstable Version](https://camo.githubusercontent.com/14e848b4966e11133e6a0f8ed674e18b6606906e2606d2aeeacf41ab4a9210b6/68747470733a2f2f706f7365722e707567782e6f72672f666564656d6f7474612f796969322d63726f6e6a6f622f762f756e737461626c65)](https://packagist.org/packages/fedemotta/yii2-cronjob) [![License](https://camo.githubusercontent.com/89fb187466c407a8da8da6ed1c22a396cb1c6686d9b9db14e329c1465063dab1/68747470733a2f2f706f7365722e707567782e6f72672f666564656d6f7474612f796969322d63726f6e6a6f622f6c6963656e7365)](https://packagist.org/packages/fedemotta/yii2-cronjob)

Yii2 extension to help in the creation of automated console scripts. It helps to manage the execution of console scripts, for example avoiding the execution if the previous cron is already running. It generates a history of cron executed, with the time spent and helps to batch processing the script.

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist fedemotta/yii2-cronjob "*"

```

or add

```
"fedemotta/yii2-cronjob": "*"

```

to the require section of your `composer.json` file.

This extension needs a database to manage the cron job execution. Run the following migration to create the table structure:

```
yii migrate --migrationPath=@fedemotta/cronjob/migrations

```

Usage
-----

[](#usage)

Once the extension is installed, you can use it as a helper in your console controller.

See the following example:

```
