PHP code example of ijvo / cronner

1. Go to this page and download the library: Download ijvo/cronner 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/ */

    

ijvo / cronner example snippets


class CronTasks {
    /**
     * @cronner-task(E-mail sending)
     * @cronner-period(1 day)
     * @cronner-days(working days)
     * @cronner-time(23:30 - 05:00)
     */
    public function sendEmails() {
        // Code which sends all your e-mails
    }

    /**
     * @cronner-task(Important data replication)
     * @cronner-period(3 hours)
     */
    public function replicateImportantData() {
        // Replication code
    }
}

class CronPresenter extends \Nette\Application\UI\Presenter {
    /**
     * @var \stekycz\Cronner\Cronner
     * @inject
     */
    public $cronner;

    public function actionCron() {
        $this->cronner->run();
    }
}

/**
 * @cronner-task(Fetches all public data from all registered social networks)
 */

/**
 * @cronner-period(1 day)
 */

/**
 * @cronner-days(working days, Sun)
 */

/**
 * @cronner-time(11:00, 23:30 - 05:00)
 */