Skip to content

switon-php/schedule

Repository files navigation

Switon Schedule Package

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.

About

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

Topics

Resources

License

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages