Wrench for FuelPHP

September 20, 2011

If you have been following what I've been up to lately you would see that many of my recent projects are based on FuelPHP. Since Fuel is so awesome and allows you to create "packages" that can be dropped into your application, I have created a few that help me quickly piece together apps. The first package I'm "releasing" is called Wrench.

Wrench is a simple command line task to take your app offline for a period of maintenance. Using the oil utility included in fuel, simply run "php oil r wrench" to toggle your app offline/online. This command takes the current state of the site into account and will switch to the opposite when run.

If you would like more control of which action is actually being run (in case of command failure), you can add :start(to take down) or :finish (to bring back online your site).

Your front end users will see a screen similar to this when viewing your app, allowing you to run any migrations, deployment scripts, or configuration changes before you want users interacting with the codebase.

To add this package to your fuel install you must do a few things,

  1. add github.com/tomschlick to the "sources" array in your app/config/package.php config file (if it does not exist yet use this one).
  2. run "php oil package install wrench"
  3. add "wrench" to the "always_load" packages & classes arrays
  4. use it!

Wrench is pretty simple right now but over the next few months I'm hoping to add some additional nice to have features. Of course it is hosted on github and available for anyone to fork/patch back to. As always just open up an issue on the repo if you have any questions or experience problems.