PHP code example of rumd3x / php-scheduler

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

    

rumd3x / php-scheduler example snippets


use Rumd3x\Scheduler\Schedule;

Schedule::action(function() {
    // Your code here
})->cron('* * * * *')->run();

use Cron\CronExpression;
use Rumd3x\Scheduler\Schedule;

Schedule::action(function(CronExpression $cron) {
    // Your code here
})->everyMinute()->run();

use Cron\CronExpression;
use Rumd3x\Scheduler\Schedule;

Schedule::action(function(CronExpression $cron) {
    // Your code here
})->setName('Test')->daily()->at('11:00')->run();

/* Prints:
    [d/m/Y H:i:s]: Job Test Started
    [d/m/Y H:i:s]: Job Test Finished
*/

->cron('* * * * *');	      // Run the task on a custom Cron schedule
->monthly();	              // Run the task every month
->monthly(13);	            // Run the task every 13th day of the month
->weekly()                  // Run the task every week
->weekly(1);	              // Run the task every Monday
->daily();                  // Run the task every Day
->hourly();                 // Run the task every Hour
->hourly(15);               // Run the task every Hour at minute 15
->everyThirtyMinutes();     // Run the task every Thirty Minutes
->everyFifteenMinutes();    // Run the task every Fifteen Minutes
->everyTenMinutes();        // Run the task every Ten Minutes
->everyFiveMinutes();       // Run the task every Five Minutes
->everyMinute();            // Run the task every Minute

->monthly()->at('12:00');	      // Run the task every month at 12:00
->weekly()->at('8:00')          // Run the task every week at 8:00
->daily()->at('9:00');          // Run the task every Day at 9:00
bash
  composer