buzzingpixel / corbomite-schedule
Corbomite Schedule
1.2.0
2019-04-12 23:27 UTC
Requires
- php: >=7.2
- buzzingpixel/corbomite-config-collector: ^1.0
- buzzingpixel/corbomite-db: ^1.2.1
- buzzingpixel/corbomite-di: ^1.0
- buzzingpixel/corbomite-migrations: ^1.0
- symfony/filesystem: ^4.2
Requires (Dev)
- codedungeon/phpunit-result-printer: ^0.26.2
- doctrine/coding-standard: ^6.0
- friendsofphp/php-cs-fixer: ^2.14
- phpmd/phpmd: ^2.6
- phpunit/phpunit: ^8.0
- roave/security-advisories: dev-master
- squizlabs/php_codesniffer: ^3.4
- symfony/var-dumper: ^4.2
This package is auto-updated.
Last update: 2024-09-23 12:32:20 UTC
README
是BuzzingPixel的Corbomite项目的一部分。
提供了一种安排任务运行的方法。
用法
当你需要在Corbomite项目中使用这个时,CLI命令和依赖注入配置将自动设置。
安装
Corbomite Schedule需要添加一个数据库表才能正常运行。为了做到这一点,它需要创建一些迁移,然后运行这些迁移。运行create-migrations命令,该命令将在你的Corobomite项目中放置迁移文件。
php app schedule/create-migrations
运行该命令后,你需要运行迁移
php app migrate/up
运行计划
在开发环境中,你可能只是想手动运行计划。要这样做,可以使用以下命令
php app schedule/run
在生产环境中,你希望每分钟通过cron运行它。以下是一个示例
* * * * * /user/bin/php /path/to/projet/app schedule/run >> /dev/null 2>&1
注册计划
你的应用程序或composer包可以提供计划。要这样做,在composer.json中的extra对象中设置scheduleConfigFilePath
键
{ "name": "vendor/name", "extra": { "scheduleConfigFilePath": "src/scheduleConfig.php" } }
你的配置文件路径的返回值应格式如下数组的格式
<?php declare(strict_types=1); return [ [ 'class' => \some\MyClass::class, 'method' => 'someMethod', // Defaults to __invoke, 'runEvery' => 'Day', // Always|FiveMinutes|TenMinutes|ThirtyMinutes|Hour|Day|Week|Month|DayAtMidnight|SaturdayAtMidnight|SundayAtMidnight|MondayAtMidnight|TuesdayAtMidnight|WednesdayAtMidnight|ThursdayAtMidNight|FridayAtMidnight ], [ 'class' => \some\OtherClass::class, // Your class will be retrieved from the Corbomite DI or falls back to new 'runEvery' => 'Day', // You can also specify minutes here ], ];
许可协议
版权所有2019年BuzzingPixel,LLC
在Apache License,Version 2.0(以下简称“许可证”)下授予许可;除非符合许可证规定,否则不得使用此文件。您可以在https://apache.ac.cn/licenses/LICENSE-2.0获取许可证副本。
除非适用法律要求或书面同意,否则在许可证下分发的软件按“原样”提供,不提供任何明示或暗示的保证或条件。有关许可协议的具体语言、权限和限制,请参阅许可证。