synolia / sylius-scheduler-command-plugin
Scheduler Command Plugin.
Installs: 267 929
Dependents: 0
Suggesters: 0
Security: 0
Stars: 31
Watchers: 12
Forks: 20
Open Issues: 11
Type:sylius-plugin
Requires
- php: ^8.2
- ext-intl: *
- ext-json: *
- dragonmantank/cron-expression: ^3.4
- sylius/sylius: ^1.12
- symfony/framework-bundle: ^5.4|^6.0
- symfony/lock: ^6.4
- symfony/polyfill-intl-icu: ^1.26
- symfony/process: ^6.4
- symfony/service-contracts: ^3.5
- webmozart/assert: ^1.11
Requires (Dev)
- behat/behat: ^3.12
- behat/mink-selenium2-driver: ^1.6
- dmore/behat-chrome-extension: ^1.4
- dmore/chrome-mink-driver: ^2.9
- friends-of-behat/mink: ^1.10
- friends-of-behat/mink-browserkit-driver: ^1.6
- friends-of-behat/mink-debug-extension: ^2.1
- friends-of-behat/mink-extension: ^2.7
- friends-of-behat/page-object-extension: ^0.3
- friends-of-behat/suite-settings-extension: ^1.1
- friends-of-behat/symfony-extension: ^2.4
- friends-of-behat/variadic-extension: ^1.5
- friendsoftwig/twigcs: 6.4.0
- j13k/yaml-lint: ^1.1
- php-parallel-lint/php-parallel-lint: ^1.4
- phpmd/phpmd: ^2.15.0
- phpro/grumphp: ^2.9
- phpspec/phpspec: ^7.3
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^2.0
- phpstan/phpstan-doctrine: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpstan/phpstan-webmozart-assert: ^2.0
- phpunit/phpunit: ^9.5
- rector/rector: ^2.0
- seld/jsonlint: ^1.11
- slevomat/coding-standard: ^8.7
- squizlabs/php_codesniffer: ^3.11
- sylius-labs/coding-standard: ^4.3
- symfony/browser-kit: ^6.4
- symfony/debug-bundle: ^6.4
- symfony/dotenv: ^6.4
- symfony/intl: ^6.4
- symfony/web-profiler-bundle: ^6.4
- symplify/easy-coding-standard: ^12.5
Suggests
- lorisleiva/cron-translator: Allow showing humanized and translated cron expression.
- dev-main
- v3.7.0
- v3.6.0
- v3.5.0
- v3.4.2
- v3.4.1
- v3.4.0
- v3.3.0
- v3.2.0
- v3.1.0
- v3.0.1
- v3.0.0
- v2.2.0
- v2.1.0
- v2.0.1
- v2.0.0
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-feature/display-pending-commands
- dev-fix/+92-live-logs
- dev-allow-logs-dir-overwrite
- dev-feature/async-runner
- dev-feature/compatibility-sylius-1-11-php-8-1
- dev-upgrade-minimal-php-version
- dev-feature/added-new-ecs-rules
- dev-fix/ci
This package is auto-updated.
Last update: 2025-02-13 16:43:09 UTC
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 command
button) - Download or live view of log files directly from the admin panel
- Define commands with a Factory (from a Doctrine migration, for example)
Requirements
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-contrib
is updated for the v3, you must addsylius_scheduler_command.yaml
frominstall/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 commands
in the Scheduled commands section in main menu to manage your Scheduled commands - Click on
Scheduled commands history
in 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 --id=5
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.