Nothing found

Schedulers

Schedulers are classes that allow scheduling messages at certain intervals or in particular times.

Simple scheduler

Simple scheduler for sending messages at particular time.

$scheduler = new Simple(new DateTime('2025-12-13 12:00')); $scheduler->schedule($message);

Campaign

Campaign scheduler allows you to start sending messages from particular time by at defined intervals. You can also define how many planned messages will be sent out after certain interval.

$scheduler = new Campaign(new DateTime('2025-12-13 12:00')); $scheduler->restriction(100 /* messages */, 2, 'hours'); $scheduler->schedule($message);

The restriction() method accepts only these units: minute, minutes, hour, hours, day, days. Any other value ends with a BulkGate\Sdk\InvalidStateException.

The start time is changed with the datetime() method, and reset() clears the counter of sent batches.

No scheduling

BulkGate\Sdk\Scheduler\None is an empty scheduler — it sends the message straight away. It is useful where you pass a scheduler conditionally.

Passing the scheduler to the sender

You do not have to call the scheduler by hand; once you set it on the sender, it applies to every message you send.

$sender->setScheduler(new Simple(new DateTime('2025-12-13 12:00'))); $sender->setScheduler(null); // cancel scheduling
Was this page helpful?