1. Go to this page and download the library: Download daycry/cronjob 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/ */
daycry / cronjob example snippets
/*
|--------------------------------------------------------------------------
| Dashboard login
|--------------------------------------------------------------------------
*/
public string $username = 'admin';
public string $password = 'admin';
$schedule->event('Foo')->setRunType('multiple')->hourly(); // Runs in all servers
$schedule->event('Foo')->setRunType('single')->hourly(); // Runs in one server
namespace Daycry\CronJob\Config;
use CodeIgniter\Config\BaseConfig;
use Daycry\CronJob\Scheduler;
class CronJob extends BaseConfig
{
/*
|--------------------------------------------------------------------------
| Cronjobs
|--------------------------------------------------------------------------
|
| Register any tasks within this method for the application.
| Called by the TaskRunner.
|
| @param Scheduler $schedule
*/
public function init(Scheduler $schedule)
{
$schedule->call(function() {
DemoContent::refresh();
})->everyMonday();
}
}