guikingone / scheduler-bundle
一个允许调度和创建重复性任务的Symfony扩展包
0.10.4
2024-02-02 13:59 UTC
Requires
- php: >=8.0
- ext-json: *
- dragonmantank/cron-expression: ^3.1
- psr/log: ^1.0 || ^2.0 || ^3.0
- symfony/config: ^5.4 || ^6.0 || ^7.0
- symfony/console: ^5.4 || ^6.0 || ^7.0
- symfony/event-dispatcher: ^5.4 || ^6.0 || ^7.0
- symfony/filesystem: ^5.4 || ^6.0 || ^7.0
- symfony/finder: ^5.4 || ^6.0 || ^7.0
- symfony/lock: ^5.4 || ^6.0 || ^7.0
- symfony/options-resolver: ^5.4 || ^6.0 || ^7.0
- symfony/process: ^5.4 || ^6.0 || ^7.0
- symfony/property-access: ^5.4 || ^6.0 || ^7.0
- symfony/serializer: ^5.4 || ^6.0 || ^7.0
- symfony/stopwatch: ^5.4 || ^6.0 || ^7.0
Requires (Dev)
- ext-pcntl: *
- ext-pdo: *
- ext-redis: *
- doctrine/dbal: ^3.3.6
- doctrine/orm: ^2.8
- friendsofphp/php-cs-fixer: ^3.13
- infection/infection: ^0.26.16
- marcocesarato/php-conventional-changelog: ^1.14
- phpdocumentor/reflection-docblock: ^5.3
- phpstan/phpstan: ^1.9.8
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-doctrine: ^1.3.31
- phpstan/phpstan-phpunit: ^1.3.3
- phpstan/phpstan-strict-rules: ^1.4.4
- phpstan/phpstan-symfony: ^1.2.19
- phpunit/phpunit: ^9.5.26
- psr/cache: ^1.0 || ^2.0 || ^3.0
- rector/rector: 0.15.10
- symfony/cache: ^5.4 || ^6.0 || ^7.0
- symfony/dependency-injection: ^5.4 || ^6.0 || ^7.0
- symfony/error-handler: ^5.4 || ^6.0 || ^7.0
- symfony/framework-bundle: ^5.4 || ^6.0 || ^7.0
- symfony/http-client: ^5.4 || ^6.0 || ^7.0
- symfony/http-kernel: ~5.4.20 || ~6.0.20 || ~6.1.12 || ~6.2.6 || ^6.3.0 || ^7.0
- symfony/mercure: ^0.5.3
- symfony/messenger: ^5.4 || ^6.0 || ^7.0
- symfony/notifier: ^5.4 || ^6.0 || ^7.0
- symfony/rate-limiter: ^5.4 || ^6.0 || ^7.0
Suggests
- symfony/http-client: For dispatching http tasks and / or using external probe clients
- symfony/messenger: For dispatching tasks to queue
- symfony/notifier: For dispatching notification tasks
- dev-main
- 0.10.4
- 0.10.3
- 0.10.2
- 0.10.1
- 0.10.0
- 0.9.4
- 0.9.3
- 0.9.2
- 0.9.1
- 0.9.0
- 0.8.1
- 0.8.0
- 0.7.1
- 0.7.0
- 0.6.2
- 0.6.1
- 0.6.0
- 0.5.5
- 0.5.4
- 0.5.3
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.9
- 0.4.8
- 0.4.7
- 0.4.6
- 0.4.5
- 0.4.4
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.0
- 0.1.0
- dev-changelog/0.10.4
- dev-tools/phpstan
- dev-feat/psr_clock
- dev-issue/51
- dev-issue/289
- dev-refactor/static_analysis_phpstan_90
- dev-build/extensions
- dev-issue/task_lock
- dev-feat/grpc
- dev-build/8.1
- dev-feat/heartbeat_worker
- dev-issue/133
- dev-issue/58_pool
- dev-issue/231
- dev-feat/apip
- dev-issue/200
- dev-issue/triggers
- dev-issue/147
This package is auto-updated.
Last update: 2024-08-31 00:26:43 UTC
README
每日运行
一个用于调度/消费重复性任务的Symfony扩展包
主要功能
- 外部传输(Doctrine、Redis等)
- 外部配置存储(Doctrine、Redis等)
- 重试/删除/排序策略
- 后台工作进程
- Symfony/Messenger 集成
- Mercure 集成
- Fibers 支持
安装
确保全局已安装Composer,如Composer文档的安装章节中所述。
composer require guikingone/scheduler-bundle
快速入门
如果未安装symfony/flex,手动更新config/bundles.php
// config/bundles.php return [ // ... SchedulerBundle\SchedulerBundle::class => ['all' => true], ];
然后在config/packages/scheduler.yaml
中配置传输
# config/packages/scheduler.yaml scheduler_bundle: transport: dsn: 'filesystem://first_in_first_out'
最后,是时候创建一个简单任务了
# config/packages/scheduler.yaml scheduler_bundle: transport: dsn: 'filesystem://first_in_first_out' tasks: foo: type: 'command' command: 'cache:clear' expression: '*/5 * * * *' description: 'A simple cache clear task' options: env: test
当配置了任务,需要执行的时间时,可以使用两种方法
- 添加cron条目
* * * * * cd /path-to-your-project && php bin/console scheduler:consume >> /dev/null 2>&1
- 在后台命令中启动命令
scheduler:consume --wait
文档
贡献
想要改进此扩展包吗?