Stars: 109
Forks: 10
Pull Requests: 215
Issues: 84
Watchers: 4
Last Updated: 2023-06-20 07:06:42
Repetitive tasks as a breath in Symfony
License: MIT License
Languages: PHP, Twig, Makefile, Dockerfile
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
composer require guikingone/scheduler-bundle
If symfony/flex is not installed, manually update the config/bundles.php
:
// config/bundles.php
return [
// ...
SchedulerBundle\SchedulerBundle::class => ['all' => true],
];
Then configure a transport in config/packages/scheduler.yaml
:
# config/packages/scheduler.yaml
scheduler_bundle:
transport:
dsn: 'filesystem://first_in_first_out'
Finally, it's time to create a simple task:
# 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
When a task is configured, time to execute it, two approaches can be used:
* * * * * cd /path-to-your-project && php bin/console scheduler:consume >> /dev/null 2>&1
scheduler:consume --wait
in a background commandWant to improve this bundle?