symfony-scheduler

Installation
SKILL.md

Symfony Scheduler (Symfony)

Use when

  • Running recurring work (reports, cleanups, syncs) without system cron entries.
  • Choosing between RecurringMessage::every(), RecurringMessage::cron(), and a custom TriggerInterface.
  • Splitting jobs into several named schedules with #[AsSchedule].
  • Preventing overlap or lost runs of heavy scheduled tasks.

Default workflow

  1. Install symfony/scheduler, then write the message and its #[AsMessageHandler] handler.
  2. Create a #[AsSchedule('default')] class implementing ScheduleProviderInterface and add RecurringMessage entries.
  3. Pick the trigger: every('5 minutes') or cron('0 */6 * * *'), with an explicit timezone for cron.
  4. Add stateful($cache) and lock($lockFactory->createLock('scheduler')) on the Schedule for heavy tasks.
  5. Run it with messenger:consume scheduler_default under Supervisor, one process per schedule.
  6. Log with PreRunEvent and PostRunEvent, and test the provider through getRecurringMessages() and getNextRunDate().
Installs
67
GitHub Stars
224
First Seen
Sep 18, 2026