Search by

kinetis / scheduler

aln-1

Recurring jobs and commands for Kinetis, declared with #[Schedule] — each due slot is claimed once in MySQL/Postgres and enqueued at least once for the existing queue worker, exactly once with kinetis/queue-sql.

Package info

github.com/kinetis-dev/scheduler

pkg:composer/kinetis/scheduler

Statistics

Installs: 3

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2026-12-03 09:11 UTC

This package is auto-updated.

Last update: 2026-12-03 09:28:44 UTC


README

Kinetis

kinetis/scheduler
Recurring jobs and commands declared with #[Schedule], each slot claimed once and run by the queue worker

Packagist Version Packagist Downloads PHP Version License CI

Part of Kinetis, a non-blocking PHP framework for API-first applications, developed in the kinetis-dev/kinetis monorepo.

Runs jobs and commands on a recurring schedule declared in code. The scheduler claims each due slot once in a MySQL or Postgres table and pushes a job for it onto kinetis/queue, where the existing queue:work worker runs it. Any number of scheduler replicas can run side by side.

use Kinetis\Scheduler\Attributes\Schedule;

#[Schedule(cron: '0 3 * * *', command: 'session:gc')]
#[Schedule(everySeconds: 30, command: 'app:sync-prices')]
final class Schedules
{
}
vendor/bin/kinetis schedule:work                 # claim and enqueue due slots every second
vendor/bin/kinetis schedule:run                  # one pass, for an external timer every minute
vendor/bin/kinetis schedule:list                 # every entry and its next due time

On a class implementing Kinetis\Queue\Job, #[Schedule] schedules that job, with arguments as its named constructor arguments.

The claims need a table

Copy the stub matching the default database connection into your kinetis/migrations migrations/ directory with a timestamp prefix, and run vendor/bin/kinetis migrate:

vendor/kinetis/scheduler/resources/migrations/create_kinetis_schedule_claims_table.mysql.php.stub
vendor/kinetis/scheduler/resources/migrations/create_kinetis_schedule_claims_table.pgsql.php.stub

Delivery

A due slot is enqueued at least once, and exactly once with kinetis/queue-sql; the job then runs at least once. A slot not claimed within 60 seconds is dropped and never caught up. See kinetis.dev/docs/scheduler.html.

Installation

composer require kinetis/scheduler

Requires PHP 8.4 or 8.5, kinetis/framework, kinetis/queue, kinetis/persistence, kinetis/database-bridge and dragonmantank/cron-expression. Full documentation: kinetis.dev/docs/scheduler.html.

License

MIT — see LICENSE.