orisai / scheduler
Cron 作业调度器 - 具有锁、并行处理等功能
2.1.2
2024-07-02 22:49 UTC
Requires
- php: 7.4 - 8.3
- dragonmantank/cron-expression: ^3.3
- orisai/clock: ^1.2.0
- orisai/cron-expression-explainer: ^1.0.0
- orisai/exceptions: ^1.1.0
- psr/log: ^1.0.0|^2.0.0|^3.0.0
- symfony/console: ^5.3.0|^6.0.0|^7.0.0
- symfony/lock: ^5.3.0|^6.0.0|^7.0.0
- symfony/polyfill-php80: ^1.29.0
- symfony/process: ^5.3.0|^6.0.0|^7.0.0
Requires (Dev)
- brianium/paratest: ^6.3.0
- infection/infection: ^0.26.0|^0.27.0|^0.28.0|^0.29.0
- orisai/coding-standard: ^3.0.0
- phpstan/extension-installer: ^1.0.0
- phpstan/phpstan: ^1.0.0
- phpstan/phpstan-deprecation-rules: ^1.0.0
- phpstan/phpstan-phpunit: ^1.0.0
- phpstan/phpstan-strict-rules: ^1.0.0
- phpunit/phpunit: ^9.5.0
- staabm/annotate-pull-request-from-checkstyle: ^1.7.0
README
调度器
Cron 作业调度器 - 具有锁、并行处理等功能
📄 查看我们的 文档。
💸 如果你喜欢 Orisai,请 捐款。感谢您!
使用调度器设置创建脚本(例如 bin/scheduler.php
)
use Cron\CronExpression; use Orisai\Scheduler\SimpleScheduler; $scheduler = new SimpleScheduler(); // Add jobs $scheduler->addJob( new CallbackJob(fn() => exampleTask()), new CronExpression('* * * * *'), ); $scheduler->run();
配置 crontab 每分钟运行您的脚本
* * * * * cd path/to/project && php bin/scheduler.php >> /dev/null 2>&1
需要更多信息?文档在这里 。