synolia / sylius-scheduler-command-plugin
Scheduler Command Plugin.
Installs: 8 998
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 10
Forks: 7
Open Issues: 2
Type:sylius-plugin
Requires
- php: ^7.2
- mtdowling/cron-expression: ^1.2
- sylius/sylius: ^1.5
- symfony/framework-bundle: ^4.4|^5.1
- symfony/lock: ^3.4|^4.3|^5.1
- symfony/process: ^4.2|^5.1
- symfony/service-contracts: ^1.1|^2.0
Requires (Dev)
- behat/behat: ^3.4
- behat/mink: ^1.7@dev
- behat/mink-browserkit-driver: ^1.3
- behat/mink-extension: ^2.2
- behat/mink-selenium2-driver: ^1.3
- friends-of-behat/page-object-extension: ^0.3
- friends-of-behat/suite-settings-extension: ^1.0
- friends-of-behat/symfony-extension: ^2.0
- friends-of-behat/variadic-extension: ^1.1
- friendsoftwig/twigcs: 4.0-beta3 as 4.0.0
- j13k/yaml-lint: ^1.1
- jakub-onderka/php-parallel-lint: ^1.0
- lakion/mink-debug-extension: ^1.2.3
- phpmd/phpmd: ^2.7
- phpro/grumphp: ^0.17.0
- phpspec/phpspec: ^6.0
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: ^0.12.1
- phpstan/phpstan-doctrine: ^0.12.1
- phpstan/phpstan-strict-rules: ^0.12.1
- phpstan/phpstan-webmozart-assert: ^0.12.1
- phpunit/phpunit: ^8.0
- povils/phpmnd: ^2.1
- sebastian/phpcpd: ^4.1
- seld/jsonlint: ^1.7
- sensiolabs/security-checker: ^5.0
- sivaschenko/utility-cron: ^1.0
- sylius-labs/coding-standard: ^3.1
- symfony/browser-kit: ^3.4|^4.3
- symfony/debug-bundle: ^3.4|^4.3
- symfony/dotenv: ^4.3
- symfony/intl: ^3.4|^4.3
- symfony/web-profiler-bundle: ^3.4|^4.3
- symfony/web-server-bundle: ^3.4|^4.3
- symplify/easy-coding-standard: ^6.1
Suggests
- sivaschenko/utility-cron: Allow showing humanized cron expression.
README
Scheduler Command Plugin
Schedule Symfony Commands in your Sylius admin panel.
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 (optional)
- Priority (highest is priority)
- Run the Command immediately
- Download, show file size, empty log files directly from the admin panel
- Define commands with a Factory (from a Doctrine migration, for example)
Requirements
Version | |
---|---|
PHP | 7.3+ |
Sylius | 1.7+ |
Installation
-
Add the bundle and dependencies in your composer.json :
With Symfony Flex :
composer config extra.symfony.allow-contrib true composer req synolia/sylius-scheduler-command-plugin
Yon can now go to step 5.
Or manually :
composer require synolia/sylius-scheduler-command-plugin
-
Enable the plugin in your
config/bundles.php
file by addSynolia\SyliusSchedulerCommandPlugin\SynoliaSyliusSchedulerCommandPlugin::class => ['all' => true],
-
Import required config in your
config/packages/_sylius.yaml
file:imports: - { resource: "@SynoliaSyliusSchedulerCommandPlugin/Resources/config/config.yaml" }
-
Import routing in your
config/routes.yaml
file:synolia_scheduled_command: resource: "@SynoliaSyliusSchedulerCommandPlugin/Resources/config/admin_routing.yaml" prefix: /admin
-
Copy plugin migrations to your migrations directory (e.g.
src/Migrations
) and apply them to your database:cp -R vendor/synolia/sylius-scheduler-command-plugin/src/Migrations/* src/Migrations 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 sivaschenko/utility-cron
Usage
- Log into admin panel
- Click on
Scheduled commands
in the Configuration section in main menu - Manage your Scheduled 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 * * *' logFile: 'reset.log' priority: 0 enabled: true - name: 'Cancel Unpaid Orders' command: 'sylius:cancel-unpaid-orders' cronExpression: '0 0 * * *' priority: 1 enabled: false
Development
See How to contribute.
License
This library is under the MIT license.
Credits
Developed by Synolia.