Cron

Contracts

CronHandler

CronHandler interface for extending cron handlers.

Namespace

Plenty\Modules\Cron\Contracts

Services

CronContainer

Register cron jobs

Namespace

Plenty\Modules\Cron\Services

Methods

public add(int $schedule, string $handlerClass):void

Use this method to add a handler class and a schedule time for your desired cron event. The action will then be triggered according to the given schedule.

Parameters
int $schedule The number of minutes for which the cron action should be scheduled. Currently allowed are: 15, 20, 60 and 3600. You can also use constants like `CronContainer::EVERY_FIFTEEN_MINUTES`, `CronContainer::EVERY_TWENTY_MINUTES`, `CronContainer::HOURLY`, `CronContainer::DAILY`;
string $handlerClass The handler class that should be triggered when the cron event is launched. This class has to extend the CronHandler interface and implement the `handle()` method.