byfareska/cron-bundle
最新稳定版本:v1.3.0
Composer 安装命令:
composer require byfareska/cron-bundle
包简介
Symfony cron
README 文档
README
Requirements
- PHP >= 8.2
- Symfony 6.1, 7.x, or 8.x
Fast setup
- Add to cron
* * * * * php bin/console cron:run - Create a class that implements
\Byfareska\Cron\Task\ScheduledTask, for example:
final class DeleteFileEveryHourTask implements ScheduledTask { public function cronInvoke(DateTimeInterface $now, bool $forceRun, OutputInterface $output): bool { if($forceRun || $now->format('i') === '0'){ $this(); return true; } return false; } public function __invoke(): void { unlink('/var/example'); } }
Useful commands
Force to run some tasks
php bin/console cron:run --task=App\\Task\\DeleteFileEveryHourTask,App\\Task\\AnotherTask
List all registered tasks
php bin/console debug:container --tag=cron.task
统计信息
- 总下载量: 2.53k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-05-01