thhan/schedule-bundle
Composer 安装命令:
composer require thhan/schedule-bundle
包简介
thhan ScheduleBundle
关键字:
README 文档
README
This bundle offers you the possibility to add console commands to a cronjob with a simple function.
Installation
composer req thhan/schedule-bundle
Register this bundle manually.
// config/bundles.php return [ // Other bundles... Thhan\ScheduleBundle\ScheduleBundle::class => ['all' => true], ];
Server configuration
Finally you create a cronjob on the server that executes the "schedule:run" command every minute.
* * * * * {path_to_symfony}/bin/console schedule:run >> /dev/null 2>&1
Usage
Add the Trait Schedule class to your console command. Extend the configuration function with the function "addCron". As parameter you pass a string or an array of strings with the formatting of cron jobs.
use Thhan\ScheduleBundle\Command\Schedule; class YourCommand extends Command { use Schedule; public function configure() { $this->setName('app:test') ->addCron('30 3 * * *') ->addCron([ '*/10 * * * *', '0 22 * * 1' ]); } }
Planned
- add jobs via configuration
- add logger for output
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-02-24