I want to use cron job in my yii2 project. I ever search it, but I only get the tutorial in linux, in the other side I use windows. So, how can I implement cron job in yii2 in windows operating system? I have gotten the tutorial from http://www.yiiframework.com/extension/yii2-cronjob/. It use extension but I don't know to use it. I don't understand some explanation like "run the SomeModel::some_method for today". So, how to implement it?
Asked
Active
Viewed 1,496 times
1 Answers
1
You can try to use this extension https://github.com/yii2tech/crontab
use yii2tech\crontab\CronJob;
use yii2tech\crontab\CronTab;
$cronJob = new CronJob();
$cronJob->min = '0';
$cronJob->hour = '0';
$cronJob->command = 'php /path/to/project/yii some-cron';
$cronTab = new CronTab();
$cronTab->setJobs([
$cronJob
]);
$cronTab->apply();

Azraar Azward
- 1,586
- 2
- 12
- 16