Download the PHP package creadev/cron-bundle without Composer
On this page you can find all versions of the php package creadev/cron-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download creadev/cron-bundle
More information about creadev/cron-bundle
Files in creadev/cron-bundle
Package cron-bundle
Short Description This bundle provides scheduled execution of Symfony2 commands
License MIT
Homepage http://github.com/predakanga/CronBundle
Informations about the package cron-bundle
ColourStream Cron Bundle
This bundle provides a simple interface for registering repeated scheduled tasks within your application, including support for installs where the host does not allow for command-line access (TODO).
This bundle is tested only against Symfony 2.1. It will likely work with Symfony 2.0, but YMMV
Installation
Installing this bundle can be done through these simple steps:
-
Add the bundle to your project as a composer dependency:
-
Update your composer installation: `
-
Add the bundle to your application kernel:
-
Update your DB schema
- Start using the bundle:
Running your cron jobs automatically
This bundle is designed around the idea that your tasks will be run with a minimum interval - the tasks will be run no more frequently than you schedule them, but they can only run when you trigger then (by running app/console cron:run
, or the forthcoming web endpoint, for use with webcron services).
To facilitate this, you can create a cron job on your system like this:
This will schedule your tasks to run at most every 5 minutes - for instance, tasks which are scheduled to run every 3 minutes will only run every 5 minutes.
Creating your own tasks
Creating your own tasks with CronBundle couldn't be easier - all you have to do is create a normal Symfony2 Command (or ContainerAwareCommand) and tag it with the @CronJob annotation, as demonstrated below:
The interval spec ("PT1H" in the above example) is documented on the DateInterval documentation page, and can be modified whenever you choose.
For your CronJob to be scanned and included in future runs, you must first run app/console cron:scan
- it will be scheduled to run the next time you run app/console cron:run