1. Go to this page and download the library: Download creatortsv/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/ */
creatortsv / scheduler example snippets
use Creatortsv\Scheduler\Registrar\ScheduleRegistrar;
use Creatortsv\Scheduler\Scheduler;
$job = function (): void {
/* your job logic here ... */
}
$scheduler = new Scheduler();
$scheduler->getRegistrar()->register($job);
$scheduler->run();
/* Initializing scheduler ... */
$expr = $scheduler->getRegistrar()->register($job);
$expr->setExpression('0 */2 * * *');
/* every two days at 00:00 */
use Creatortsv\Scheduler\Provider\ScheduleProviderInterface;
use Creatortsv\Scheduler\Registrar\ScheduleRegistrarInterface;
class MyScheduleProvider implements ScheduleProviderInterface
{
public function boot(ScheduleRegistrarInterface $registrar): void
{
// Register specific jobs here ...
}
}