Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Running FuelPHP from unix command line
  • Hi,

    I recently started to migrate another project to FuelPHP (which I think is awesome!).

    Now, legacy codebase is heavly based on cron and running individual scripts form command line.
    Is there an easy way to run Fuel based controllers/ actions as regular php scripts ?

    Obviously, I could use something like WGET to start the script by targetting its url but I'm wondering is there an easy way os some sort of interface to provide all required params in a nice way ?

    Also, is this fuels CLI any useful for that ? This asprct isn't widely covered by the documentation.

    Thak you
  • HarroHarro
    Accepted Answer
    Yup, create an oil task. You are correct that these should be documented better.

    In short:
    - they are classes placed in /app/tasks or /packages/packagename/tasks
    - they are always in the namespace \Fuel\Tasks
    - "oil refine taskname" by default calls the static method run()
    - use "oil refine taskname:method" to call other methods

    Best option I think is to have a look at the tasks that are included in the Fuel Core, like migrate and session, to see how they work.
  • Thank you.

    Is there any way I could help improving the documenation?
  • Yes, sure.

    Fork the 1.9/dev branch of the fuel/docs repo on github, make your improvements, and sent us a pull request.

    The tasks page:

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion