|Classes of Emil Kilhage||>||Symfony Task bundle||>||README.md||>||Download|
Provides a simple framework to manage scheduling and execution of tasks Symfony application.
This bundle requires cron to be installed on the server to be able to execute scheduled tasks
Add the GloobyTaskBundle to your application's kernel:
Create this file /etc/cron.d/glooby_scheduler_run
Create a executable Task
To setup a new runnable task you should follow these steps
Implement the TaskInterface
Add a service for your task
Try and run the task trough cli
Setup Scheduled task
To setup a new schedule you should follow the steps below
Make your service runnable
Follow the steps in Create a executable Task
Tag your service
By tagging your service with the glooby.scheduled_task tag it will be treated as a scheduled task
Annotate your class
Annotate your class with this annotation: Glooby\TaskBundle\Annotation\Schedule
The first parameter to the annotation is defaulted to the interval parameter. In this parameter you configure the interval that the service should be executed.
The interval is a string of five or optional six subexpressions that describe details of the schedule. The syntax is based on the Linux cron daemon definition.
This is the only required parameter
Here you have several shortcuts that you can use instead for most common use cases
| value | interval | |:---------------:|:------------:| | @yearly | 0 0 1 1 * | | @annually | 0 0 1 1 * | | @monthly | 0 0 1 | | @weekly | 0 0 0 | | @daily | 0 0 * | | @hourly | 0 | | @semi_hourly | /30 * | | @quarter_hourly | /15 * | | | |
The params that should be used when calling
Phe active parameter tells if the schedule should be active or not, default=true
Sync schedules to the database, this has to be run after each update
Running the Tests
Install the dependencies:
Then, run the test suite:
See CONTRIBUTING file.
This bundle is released under the MIT license. See the complete license in the bundle: LICENSE.md