PHP code example of fm-labs / cakephp-cron

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

    

fm-labs / cakephp-cron example snippets


namespace App\Cron

class MyCronTask implements \Cron\Cron\ICronTask {

    public execute() {
        // ... do some magic ...
        //return new CronTaskResult(false, "Something went wrong")
        return new CronTaskResult(true, "Success")
    }
}

\Cron\Cron::setConfig('my_cron', [
    'className' => \App\Cron\MyCronTask,
    'interval' => 3600, // interval in seconds
])