Search code examples
phpscheduled-tasksschedulingcron

PHP function that receive a cron string and return the next run timestamp


I need to develop a task system that should be able to work on servers that doesn't support crontab.

I'm asking if there is any existing code that can take a cron string (e.g. '0 0,12 1 */2 *' and return the timestamp of the next scheduled run.

If such a code couldn't be found then how should I start with that?


Solution

  • You could use this class PHP-Parse-cron-strings-and-compute-schedules

    It'll also compute the last scheduled run