switon/schedule

Recurring scheduled tasks with a shared app clock, discovery, and optional Redis locking for Switon Framework

Maintainers

Package info

github.com/switon-php/schedule

Documentation

pkg:composer/switon/schedule

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-06-07 04:56 UTC

This package is auto-updated.

Last update: 2026-06-07 05:01:27 UTC


README

Schedule CI PHP 8.3+

Switon's scheduled task layer for #[Scheduled] runners, task discovery, locking, and CLI execution.

Highlights

  • Task registration: #[Scheduled] declares scheduled work on runner classes.
  • Automatic discovery: app task paths and package metadata are scanned.
  • Task execution: TaskRunner matches schedules and dispatches tasks.
  • Distributed locking: Redis-backed exclusivity is available across replicas.
  • CLI control: ScheduleCommand covers work, run, list, and task inspection.

Installation

composer require switon/schedule

Quick Start

use Switon\Core\RunnerInterface;
use Switon\Schedule\Attribute\Scheduled;

#[Scheduled('0 * * *', lockTtl: 60)]
final class PurgeStaleSessionsTask implements RunnerInterface
{
    public function run(mixed $payload): mixed
    {
        return null;
    }
}
bash bin/console schedule:list
bash bin/console schedule:run

Docs: https://docs.switon.dev/latest/schedule

License

MIT.