PHP code example of hyperia / yii2-cron
1. Go to this page and download the library: Download hyperia/yii2-cron library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hyperia / yii2-cron example snippets
public function behaviors()
{
return array(
'LockUnLockBehavior' => array(
'class' => 'hyperia\cron\commands\behaviors\LockUnLockBehavior',
'timeLock' => 0 //Set time lock duration for command in seconds
)
);
}
class AwesomeCommand extends DaemonController
{
/**
* Daemon name
*
* @return string
*/
protected function daemonName(): string
{
return 'mail-queue';
}
/**
* Run send mail
*/
public function worker()
{
// Some logic that will be repeateble
}
}