New package proposal: yiisoft/schedule — recurring tasks for Yii 3 #530
Replies: 3 comments 5 replies
|
Overall, having plain |
|
@samdark For static, environment-independent jobs that's true — plain crontab + flock wins, and the package doesn't try to replace that case. Where crontab stops being leaner is when scheduling touches the application: container-built callables, config or feature flags deciding whether a task exists at all, overlap prevention via the app's mutex, missed-run catch-up after downtime, queue messages through So the pitch isn't "cron, but in PHP" — it's "one cron entry, tasks defined next to the code they run." |
Uh oh!
There was an error while loading. Please reload this page.
At work we are migrating a large project from Yii 2 to Yii 3, and one capability we lost in the move is scheduling: omnilight/yii2-scheduling (316 stars, 1.1M downloads) hard-requires
yiisoft/yii2, so it simply cannot be installed in a Yii 3 application. This package started as our partial solution to that problem, extracted and generalized.Proposal: a new framework-agnostic package,
yiisoft/schedule— recurring tasks defined in PHP, driven by a single cron entry (schedule:run) or a daemon (schedule:work).Design sketch, borrowing the parts of Symfony Scheduler that proved out:
TriggerInterfaceas a pure function (last run → next run), with cron (dragonmantank/cron-expression), periodic-interval and callback implementationsyiisoft/queueyiisoft/mutex, missed-run catch-up via any PSR-16 cache, PSR-14 events (where Sentry cron check-ins plug in)yiisoft/yii-consoleparams — zero application wiringA working implementation with tests and full QA tooling is up at KalimeroMK/yii-schedule — happy to transfer it to the yiisoft org, or keep it as a community package if you prefer.
Mainly looking for feedback on: the naming, the queue integration boundary, and whether this is something you'd want as an official package.
All reactions