nicoren / cron-bundle
Symfony cron
Installs: 40
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 4
Type:symfony-bundle
Requires
- php: >=7.3
- doctrine/doctrine-bundle: ^2.2|2.3
- doctrine/mongodb-odm-bundle: ^4.1|4.2|4.3
- symfony/cache: ^4.4|^5.0|^5.1|^5.2
- symfony/framework-bundle: ^4.4|^5.0|^5.1|^5.2
- symfony/process: ^4.4|^5.0|^5.1|^5.2
Requires (Dev)
- phpunit/phpunit: ^9.5
- symfony/symfony: ^4.4|^5.0|^5.1|^5.2
README
Cron is schedule integration for symfony.
Cron integration for symfony.
Installation
Installing this bundle can be done through these simple steps:
- Add the bundle to your project as a composer dependency: With symfony Flex :
composer config extra.symfony.allow-contrib true
composer require nicoren/cron-bundle
without symfony Flex :
composer require nicoren/cron-bundle
- Add the bundle to your application kernel : If you don't use Symfony flex
// app/AppKernel.php public function registerBundles() { $bundles = [ // ... new Nicoren\CronBundle\CronCronBundle(), ]; // ... }
- Update your DB schema
3.1. ( doctrine ORM)
bin/console make:migration bin/console doctrine:migrations:migrate
3.2. ( doctrine odm)
doctrine:mongodb:schema:update
- Configuration Overview: edit or create file config/packages/nicoren_cron.yaml
# config/packages/nicoren_cron.yaml nicoren_cron: db_driver: mongodb # other valid values are 'mongodb' and 'couchdb' job_class: Nicoren\CronBundle\Model\Job timezone: "Europe/Paris"
- To run your cron jobs automatically, add the following line to your (or whomever's) crontab:
* * * * * /path/to/symfony/install/app/console cron:run 1>> /dev/null 2>&1
Available commands
list
bin/console cron:job:list
Show a list of all jobs.
create
bin/console cron:job:create
Create a new job.
delete
bin/console cron:job:delete _jobId_
Delete a job. For your own protection, the job must be disabled first.
enable
bin/console cron:job:enable _jobId_
Enable a job.
disable
bin/console cron:job:disable _jobId_
Disable a job.
run all jobs schelduled at current time
bin/console cron:run
which we borrowed from Symfony. Make sure to check out php-cs-fixer as this will help you a lot.
Please note that--force
forces the job to be executed (even if disabled) based on the job schedule
Requirements
PHP 7.3 or above
Author and contributors
Nicolas RENAULT - nicoren44@gmail.com
License
CronBundle is licensed under the MIT license.