rundiz/php-scheduler

Run the task on shcedule using PHP.

1.0.2 2021-12-13 07:37 UTC

This package is auto-updated.

Last update: 2024-11-13 14:06:38 UTC


README

Run the task on shcedule using PHP. This is not cron job or cron tab but it is the schedule tasks using PHP.
You may need cron job or not, in case that there is no cron job just include it in the main PHP file that always called when users visited the webpage.

Latest Stable Version License Total Downloads

Example:

$PhpSchedule = new \Rundiz\PhpSchedule\PhpSchedule();
$PhpSchedule->add('unique-name', 'https://mysite.localhost/page/to/works', ['12', '15']);// run on 12 (midday) and 15.
$PhpSchedule->run();

Or you can run task using your function/class.

$PhpSchedule = new \Rundiz\PhpSchedule\PhpSchedule();
$PhpSchedule->add('unique-name1', 'myFunction', ['12', '15']);// run on 12 (midday) and 15.
$PhpSchedule->add('unique-name2', ['myStaticClass', 'myStaticMethod'], ['12', '15']);// run on 12 (midday) and 15.
$MyClass = new MyClass();
$PhpSchedule->add('unique-name3', [$MyClass, 'myMethod'], ['12', '15']);// run on 12 (midday) and 15.
$PhpSchedule->run();

For more example, please look inside tests folder.