PHP code example of battis / autocrontabjob

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

    

battis / autocrontabjob example snippets




tend the abstract class with our own scheduledJob() method
class MyJob extends Battis\AutoCrontabJob {

	public function scheduledJob() {
		$this->log->log('I did something!');
	}
}

// instantiate our class
$job = new MyJob(
	'example',
	__FILE__, // *this* file will be called by crontab
	'*/5 * * * *' // run every five minutes (woo hoo!)
);

// fire the scheduledJob() method
$job->scheduledJob();