PHP code example of contao-community-alliance / events-cron

1. Go to this page and download the library: Download contao-community-alliance/events-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/ */

    

contao-community-alliance / events-cron example snippets


$GLOBALS['TL_EVENTS']['cron.monthly'][] = function($event) {
	// run monthly
};

$GLOBALS['TL_EVENTS']['cron.weekly'][] = function($event) {
	// run weekly
};

$GLOBALS['TL_EVENTS']['cron.daily'][] = function($event) {
	// run daily
};

$GLOBALS['TL_EVENTS']['cron.hourly'][] = function($event) {
	// run hourly
};

// only support in Contao 3.0 or newer
$GLOBALS['TL_EVENTS']['cron.minutely'][] = function($event) {
	// run minutely
};