Modular CI

Derek Jones edited this page Jul 5, 2012 · 36 revisions
Clone this wiki locally

Requirements:

  • CodeIgniter version 1.7.2
  • CodeIgniter version 2.0
  • PHP5+

Introduction:

Modular extensions for CodeIgniter have been around for quite some time: Modular Extensions, HMVC, Matchbox and Modular Separation.

While designing an application framework based on CodeIgniter, I needed a much more flexible system than what is on offer by the extensions mentioned above.

A module in my definition is a complete CodeIgniter mini-application. It needed to support all elements you have in a regular application folder: controllers, models, views, libraries and helpers. All these elements must be loadable using the CodeIgniter standard, automatic, and with a minimum of configuration. And this includes controllers loading other controllers, and models loading other models, to support true HMVC. At the same time, the solution needs to support modulair routing. Not with a fixed format (for example the first URI segment has to be the module name), but using regular CI routing. Also, I wanted as little impact on a standard CodeIgniter installation, as every extension of a core library method might break some CodeIgniter functionality in the future.

Features:

  • Location of your modules is configurable
  • Supports routing to a module controller
  • Supports cross module calls, also to controller methods
  • Uses standard CodeIgniter routing, no Router library modifications
  • Introduces $this->load->module() via a Loader library extension
  • Support for the default index() method and the _remap() method when routing
  • Supports loading models without CI object assignment, to support ORM libraries
  • Supports module controller return values for true HMVC (as suggested by n0xie)
  • Allow loading of modules from alternate locations (p.e if you have a modules and a themes directory with a module structure)
  • Allows loading your application folder as a module, so you can call these controllers too

Documentation

Modular CI is fully documented in the readme included in the download. You can read this online on the bitbucket website.

Download:

Modular CI is available on BitBucket. Click on the 'get source' button to download the code, or clone the repository using Mercurial.

Alternatively, you can download the latest version directly here.

Discuss:

See this forum thread.

Developed by WanWizard