Cron
Source-reviewed against the pinned revision below. This is a component integration guide, not a claim of a complete tested application matrix.
Package and installation
Section titled “Package and installation”triangle/cron · AGPL-3.0-or-later
composer require triangle/croncomposer check-platform-reqscomposer show triangle/cronThe command resolves the available release, not necessarily the source revision reviewed here. Keep and validate your application lock. Direct requirements do not describe all transitive PHP/extension constraints.
| Requirement | Constraint |
|---|---|
php | ^8.1 |
triangle/engine | ^8.1 |
triangle/events | ^1.0 |
localzet/cron | ^1.0 |
Lifecycle
Section titled “Lifecycle”Triangle\Cron\Autoload::start() runs for Engine manage commands, creates a dedicated single-worker Cron server and registers each valid configured callback in onServerStart. The underlying scheduler is localzet/cron. This is in-process scheduling, not a durable queue or a cluster-wide singleton.
Configuration
Section titled “Configuration”config/cron.php returns a list with rule, callback and optional name. The former schedule/task example is not read by this implementation; no TaskInterface is provided.
Example
Section titled “Example”<?phpreturn [ [ 'name' => 'heartbeat', 'rule' => '*/5 * * * *', 'callback' => static function (): void { error_log('Scheduled heartbeat'); }, ],];Reliability and failure handling
Section titled “Reliability and failure handling”A missing rule/callback is silently skipped by this bootstrap. Rule grammar, timezone and exception behavior belong to the installed localzet/cron version; validate there before release. Restart/reload according to your application lifecycle after config changes. Multiple app replicas each schedule their own tasks: use an external lock and idempotency for shared jobs. Do not perform blocking long work in the scheduling callback; enqueue durable work explicitly.
Source and verification
Section titled “Source and verification”Cron · b23f5816f792. Framework startup limits.