PHP code example of phpbook / scheduler

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

    

phpbook / scheduler example snippets




/********************************************
 * 
 *  Scheduler Tasks Example
 * 
 * ******************************************/

$taskName = 'Send Emails'; // task name

$taskCommand = 'php ' . __DIR__ . '/send-mails.php'; // or any another command to run whatever the location of the file

$intervalMinutes = 5; // interval in minutes

\PHPBook\Scheduler\Task::register($taskName, $taskCommand, $intervalMinutes); // register the task

\PHPBook\Scheduler\Task::register($taskName, $taskCommand, $intervalMinutes); // register or update the task

\PHPBook\Scheduler\Task::remove($taskName); // remove the task by the task name