Skip to content

Schedule

Viames Marino edited this page Feb 23, 2026 · 1 revision

Pair framework: Schedule

Pair\Helpers\Schedule provides a fluent scheduler for cron-like execution windows.

Main methods

  • command(callable $functionToRun, mixed $args = null): self
  • everyMinute(), everyTwoMinutes(), everyFiveMinutes(), everyTenMinutes(), everyThirtyMinutes()
  • hourly(), hourlyAt(int $minutes), everyTwoHours(), everySixHours()
  • daily(), dailyAtNoon(), dailyAt(string $time), twiceDaily(string $time1, string $time2)
  • weekly(), weeklyOn(int $dayOfTheWeek, string $time)
  • monthly(), monthlyOn(int $dayOfTheMonth, string $time), lastDayOfMonth(string $time)
  • quarterly(), yearly(), yearlyOn(int $month, int $dayOfTheMonth, string $time)

Implementation example

$schedule = new \Pair\Helpers\Schedule();

$schedule
    ->command(function () {
        (new CleanupService())->run();
    })
    ->dailyAt('02:30');

Notes

  • command() stores the callback and optional arguments.
  • Frequency methods return the scheduler result used by the internal engine.

See also: ScheduleLog, Log.

Clone this wiki locally