Backfills, cleanups, and purges over big tables — batched, checkpointed, and resumable. You write the per-record logic. Chores handles the rest. No Redis, no queue workers.
Kill it mid-run — deploy, crash, Ctrl+C. Run the same command again and it resumes from the last checkpoint. No row skipped, no row processed twice.
Two methods: which records still need work, and what to do to one record. Batching, ordering, progress, resume, and failure bookkeeping are not your problem anymore.
class NormalizePhoneNumbers extends Chore { // Which records still need work. public function collection(): Builder { return User::whereNotNull('phone')->where('phone', 'not like', '+%'); } // Handle ONE record. Throwing marks it failed — the run continues. public function process($record): void { $record->update(['phone' => PhoneNumber::parse($record->phone, 'EG')->toE164()]); } }
Chores iterates by WHERE id > cursor — keyset pagination — and checkpoints to the database after every batch. Kill the process any way you like: on resume, only the rows of the single in-flight batch are re-examined.
Exactly-once beyond the current batch. At-least-once within it. Write process() so handling the same record twice is harmless — most update-style operations already are — and you're fully covered.
| make:chore {name} | Scaffold a chore class in app/Chores |
| chore:run {name} | Run a chore — or resume its open run — with live progress |
| chore:list | Available chores and recent run history |
| chore:pause {name} | Pause a running chore at its next batch boundary |
| chore:failures {name} | Failed records with their exceptions |
| chore:retry {name} | Re-process only the failed records |
--json on run & failures for CI pipelines and AI coding agents. Exit codes: 0 clean · 1 had failures · 2 fatal.