phpbook/scheduler

1.0.1 2022-03-11 20:35 UTC

This package is auto-updated.

Last update: 2024-05-12 01:18:58 UTC


README

About Scheduler

  • A lightweight scheduler PHP library.
  • With WINDOWS this library use the Task Scheduler
  • With LINUX this library use the CRONTAB

Composer Install

composer require phpbook/scheduler

Scheduler Tasks Example

<?php

/********************************************
 * 
 *  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

?>