O'Reilly logo

Learning FuelPHP for Effective PHP Development by Ross Tweedie

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Tasks

Sometimes, we will want background processes, periodic tasks, or maintenance tasks to occur. This is where FuelPHP tasks come in handy. They can be run via the command-line tool, or set up as a periodic task on Windows, or cron job on Mac OSX and *nix. They can call upon modules and other classes just like controllers can.

Tasks should be placed in the fuel/app/tasks folder and, by default, only a run() method needs to be defined within the class. If you need other methods, these can be added in the usual way for PHP classes.

The tasks are called using the Oil refine command. FuelPHP comes with an example task called robots and will be included in the fuel/app/tasks folder.

To call the main method of the robot task, you can run the following ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required