Codeigniter & Joomla Integration – Part 1

We ran into a situation a while ago that required us to use Joomla‘s user management, content management framework along side Codeigniter. After several failed attempts, we did find a sweet spot where Joomla was set up as a sub framework within codeigniter, and all custom code written within the Codeigniter classes would have access to Joomla API. This guide will assume that you are already familiar with both the frameworks in question and have a decent knowledge of PHP.

  • Grab the latest versions of these frameworks from
  • Extract the Joomla archive into the desired project folder and complete the installation.
  • Extract the Codeigniter archive into a different folder and copy the application and system folders into the project folder.
  • Rename the Joomla’s index.php file to index.php.bak
  • Copy Codeigniter’s index.php file to the project folder.
  • Copy all code before “// Mark afterLoad in the profiler. ” from the Joomla index.php into the new index.php file. Paste the code before “LOAD THE BOOTSTRAP FILE” comment.
  • You final index.php should look something like below.

Edit the welcome.php under application/controllers to look like this

That’s it.

You should now have a Joomla site running inside the Codeigniter framework. Any routes not defined in application/config/routes.php will be handled by Joomla. Make sure you never create routes that match any Joomla directories :)

 

Continue to Codeigniter & Joomla Integration – Part 2