Overview

fire : CodeIgniter Controller and Model generator

This little script lets you generate controllers and models very easily in your codeigniter-based app.

Installation

The first thing you have to do is move the fire script to a folder of your choice. For the sake of the exemple, I will put it in ~/bin. You then have to add ~/bin to your PATH. In Unix-based systems, add the following line to .bashrc, .bash_profile, .zshrc or the like: (In OS X)

PATH=/Users/aziz/bin:$PATH

Obviously you would have to replace aziz by your user name. Also, make sure that fire is executable. On Unix-based systems (from the command line):

chmod a+x fire

Basic usage

Fire works out of the box, all you have to do is navigation to the application folder via the command line and use the fire command. Some examples:


fire controller posts

This command will create a posts controller in the controllers folder.


fire controller

This will also create a controller, however the user will be asked to enter a name.


fire model post

This command will create a post model in the models folder.


fire model

This will also create a model, however the user will be asked to enter a name.

Advanced usage

You can create multiple controllers/models at the same time and add new actions/methods to those controllers/methods. There is a couple of keywords that you can use:

  • new: create new actions/methods.
  • controller: create additional controllers.
  • model: create additional models.

Examples

Create three controller:

fire controller posts comments pages

This command will create the Posts, Comments and Pages controllers.

Create a controller and add two actions to it:

fire controller posts new add edit

This command will create the Posts controller and add to it the add and edit actions.

Create a controller and add one action and one private method to it:

fire controller posts new view _count

This command will create a Post controller and add to it the view action and the _count private method.

Create multiple controllers and models with each additional public/private actions/methods:

fire controller posts new add edit _count controller comments new add edit approve _is_spam model post new get_one get_many update delete add _get_comments

This command will create two controller and a model:

  • The Posts controller with the following actions/methods:
    • The add action
    • The edit action
    • The _count private method
  • The Comments controller with the following actions/methods:
    • The add action
    • The edit action
    • The approve action
    • The _is_spam private method
  • The Post model with the following methods:
    • The get_one public method
    • The get_many public method
    • The update public method
    • The delete public method
    • The add public method
    • The _get_comments private method

Changelog

03/13/2010

  • New feature: Create new CodeIgniter projects (Work in progress - Additional features coming soon).
  • Updated: Removed all the references to the source of the errors/warning in the message outputs that use user sees.

03/02/2010

  • New feature: Create multiple controllers/models at a time.
  • New feature: Add public/private actions/methods to new controllers/models.
  • Updated: Better notification system.
  • Soon: Create new CodeIgniter projects.