Oil utility

The Oil utility is a special package command can be used in several ways to facilitate quick development, help with testing your application and for running Tasks.

Oil is an optional command line utility designed to help speed up development by providing several functions:

  • Generate - Build MVC components, migrations and entire scaffolding.
  • Refine - Run tasks such as migrate and your own custom ones.
  • Package - Install, update and remove packages.
  • Console - Test your code in real time using an interactive shell.
  • Test - Run PHPUnit tests.

Each of these commands works in a different way to achieve different things, but before getting into them it's best to make sure you are in the correct folder and oil is available and running.

$ cd Sites/fuel
$ php oil -v
Fuel: 1.2

Environments

Oil won’t use any instructions you’ve made for HTTP requests, such as defining the server environment using .htaccess. Oil will use whichever environment is the default unless you instruct it.

$ FUEL_ENV=production php oil refine migrate

In place of production you can use any of the defined environments.

In-line help

Oil contains its own basic documentation which can be found by typing the command:

$ php oil help

Usage:
  php oil [console|generate|package|refine|help|test]

Runtime options:
  -f, [--force]    # Overwrite files that already exist
  -s, [--skip]     # Skip files that already exist
  -q, [--quiet]    # Suppress status output
  -t, [--speak]    # Speak errors in a robot voice

Description:
  The 'oil' command can be used in several ways to facilitate quick development, help with
  testing your application and for running Tasks.

Documentation:
  http://docs.fuelphp.com/packages/oil/intro.html

Each of these commands has its own help section which can be found by typing:

$ php oil generate help