synolia/sylius-scheduler-command-plugin
Composer 安装命令:
composer require synolia/sylius-scheduler-command-plugin
包简介
Scheduler Command Plugin.
README 文档
README
Scheduler Command Plugin
Schedule Symfony Commands in your Sylius admin panel.
Commands list
Scheduled Commands list
Features
- See the list of planned command
- Add, edit, enable/disable or delete scheduled commands
- For each command, you have to define :
- Name
- Selected Command from the list of Symfony commands
- Based on Cron schedule expression see Cron formats
- Output Log file prefix (optional)
- Priority (highest is priority)
- Run the Command immediately (at the next passage of the command
synolia:scheduler-run) - Run a Command juste one time (from history page clic on
Launch a commandbutton) - Download or live view of log files directly from the admin panel
- Define commands with a Factory (from a Doctrine migration, for example)
Requirements
| Version | |
|---|---|
| PHP | ^8.2 |
| Sylius | ^1.12 |
Installation
-
Add the bundle and dependencies in your composer.json :
composer config extra.symfony.allow-contrib true composer req synolia/sylius-scheduler-command-plugin -
Apply migrations to your database:
bin/console doctrine:migrations:migrate -
Launch Run command in your Crontab
* * * * * /_PROJECT_DIRECTORY_/bin/console synolia:scheduler-run -
(optional) Showing humanized cron expression
composer require lorisleiva/cron-translator -
Till
symfony/recipes-contribis updated for the v3, you must addsylius_scheduler_command.yamlfrominstall/Application/config/{packages,routes}to your project by respecting the same folder architecture.cp -R vendor/synolia/sylius-scheduler-command-plugin/install/Application/config/packages/* config/packages/ cp -R vendor/synolia/sylius-scheduler-command-plugin/install/Application/config/routes/* config/routes/
Usage
- Log into admin panel
- Click on
Scheduled commandsin the Scheduled commands section in main menu to manage your Scheduled commands - Click on
Scheduled commands historyin the Scheduled commands section in main menu to see history of commands
Fixtures
Inside sylius fixture file config/packages/sylius_fixtures.yaml you can add scheduled command fixtures to your suite.
sylius_fixtures: suites: my_fixture_suite: fixtures: scheduler_command: options: scheduled_commands: - name: 'Reset Sylius' command: 'sylius:fixtures:load' cronExpression: '0 0 * * *' logFilePrefix: 'reset' priority: 0 enabled: true - name: 'Cancel Unpaid Orders' command: 'sylius:cancel-unpaid-orders' cronExpression: '0 0 * * *' priority: 1 enabled: false
Commands
synolia:scheduler-run
Execute scheduled commands.
- options:
- --id (run only a specific scheduled command)
Run all scheduled commands : php bin/console synolia:scheduler-run
Run one scheduled command : php bin/console synolia:scheduler-run --only-one
Run a specific scheduled command : php bin/console synolia:scheduler-run --id=5
Is it possible to choose the timezone of the command execution by setting the SYNOLIA_SCHEDULER_PLUGIN_TIMEZONE environment variable, example:
SYNOLIA_SCHEDULER_PLUGIN_TIMEZONE=Europe/Paris
synolia:scheduler:purge-history
Purge scheduled command history greater than {X} days old.
- options:
- --all (purge everything)
- --days (number of days to keep)
- --state (array of schedule states)
- --dry-run
Example to remove all finished and in error scheduled commands after 7 days :
php bin/console synolia:scheduler:purge-history --state=finished --state=error --days=7
Optional services
services: ... # By enabling this service, it will be requested to vote after the other EveryMinuteIsDueChecker checker. # Using some cloud providers, even if the master cron is set to run every minute, it is actually not run that often # This service allows you to set a soft threshold limit, so if your provider is actually running the master cron every 5 minutes # This service will execute the cron if we are still in the threshold limit ONLY IF it was not already executed another time in the same range. # # CONFIGURATION SCENARIO: cron set to be run at 01:07 in the scheduler command plugin # # SCENARIO CASES AT 1 CRON PASS EVERY 5 MINUTES FROM THE PROVIDER # cron passes at 01:04 - 1..5 minutes: IS NOT DUE # cron passes at 01:05 - 1..5 minutes: IS NOT DUE # cron passes at 01:06 - 1..5 minutes: IS NOT DUE # cron passes at 01:07 - 1..5 minutes: IS DUE (but it should already be handled by EveryMinuteIsDueChecker) # cron passes at 01:08 - 1..5 minutes: IS DUE # cron passes at 01:09 - 1..5 minutes: IS DUE #should not if another has started during the threshold period # cron passes at 01:10 - 1..5 minutes: IS DUE #should not if another has started during the threshold period # cron passes at 01:11 - 1..5 minutes: IS DUE #should not if another has started during the threshold period # cron passes at 01:12 - 1..5 minutes: IS DUE #should not if another has started during the threshold period # cron passes at 01:13 - 1..5 minutes: IS NOT DUE Synolia\SyliusSchedulerCommandPlugin\Checker\SoftLimitThresholdIsDueChecker: tags: - { name: !php/const Synolia\SyliusSchedulerCommandPlugin\Checker\IsDueCheckerInterface::TAG_ID } #optionnal, default value is 5 minutes arguments: $threshold: 5 #soft limit threshold in minutes
Development
See How to contribute.
License
This library is under the MIT license.
Credits
Developed by Synolia.
synolia/sylius-scheduler-command-plugin 适用场景与选型建议
synolia/sylius-scheduler-command-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 385.7k 次下载、GitHub Stars 达 34, 最近一次更新时间为 2020 年 01 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「command」 「sylius」 「scheduler」 「sylius-plugin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 synolia/sylius-scheduler-command-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 synolia/sylius-scheduler-command-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 synolia/sylius-scheduler-command-plugin 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Wrapper for exec and it's results
Symfony bundle to monitor and execute commands
Implementation of the Omnibus Directive for Sylius application.
Bulk export of sylius resources
Sylius plugin that integrates Addwish
Setono example plugin for Sylius.
统计信息
- 总下载量: 385.7k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 34
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-01-13

