Download the PHP package glooby/task-bundle without Composer
On this page you can find all versions of the php package glooby/task-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package task-bundle
task-bundle
Provides a simple framework to manage scheduling and execution of tasks Symfony application.
Prerequisite
This bundle requires cron to be installed on the server to be able to execute scheduled tasks
Installation
Add the glooby/task-bundle
package to your require
section in the composer.json
file.
Add the GloobyTaskBundle to your application's kernel:
Create this file /etc/cron.d/glooby_scheduler_run
Documentation
Create a executable Task
To setup a new runnable task you should follow these steps
Implement the TaskInterface
example: src/Glooby/Api/TaskBundle/Task/PingTask.php
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](#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
example:
src/Glooby/Api/TaskBundle/Resources/config/services.yml
Annotate your class
Annotate your class with this annotation: Glooby\TaskBundle\Annotation\Schedule
Parameters
interval
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 * |
* | * |
params
The params that should be used when calling
active
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:
Contributing
See CONTRIBUTING file.
License
This bundle is released under the MIT license. See the complete license in the bundle: LICENSE.md
All versions of task-bundle with dependencies
symfony/framework-bundle Version ~4.3
doctrine/orm Version ~2.6
dragonmantank/cron-expression Version ~2.0