Skip to content

Framework_Schedule

StefansArya edited this page Apr 19, 2019 · 1 revision

The schedule need to be written in /routes/schedule.php and you will need to install the CronJob to let the framework check and running your schedule $ scarlets schedule install 5. It's possible to have 1 minute interval, but it would make your hard drive couldn't save power or possible overheat. So 5 minutes interval is recommended.

You can also manually trigger the check by run $ scarlets schedule tick from the console.

Below are available function for the library

function description
cron CronTab expression
everyMinutes Run task every minute at 0 second
hourly Run task every hour at 0m and 0s
daily Run task every day at midnight
weekly Run task every week at midnight
monthly Run task every month at midnight
yearly Run task every year at midnight

Example

// With cron expression
Schedule::cron('*/5 * * * *', function(){
    /* ... */
});

// Every hour
Schedule::hourly(function(){
    /* ... */
});

// Every 2 week
Schedule::weekly(2, function(){
    /* ... */
});
Clone this wiki locally