codeIgniter HMVC VPS Cloud Hosting Virtual Private Server - BIP mediacodeIgniter HMVC is based on the Model-View-Controller development pattern. MVC is a software approach that separates application logic from presentation. In practice, it permits your web pages to contain minimal scripting since the presentation is separate from the PHP scripting.

Most of the developers, from beginner to advance level know about codeigniter HMVC, because it’s easy to used, great for small to large projects. Its fantastic and quick for creating your own CMS (Content Management System) and many web applications that you might want to create.

Before we start to implements Codeigniter HMVC into our Framework, I would like to discuss first the importance of HMVC Pattern in web development.

HMVC is well known for Hierarchical model–view–controller. So what are the benefits of using HMVC Pattern? Well using HMVC you can divide your application by modules. By dividing your work into modules you can apply new features without editing the others controllers that is not related to your new features. HMVC is also called widgetization because you can used any modules to another modules.

Let’s start to implement Codeigniter HMVC Framework.

1. First and for most, lets download the latest stable version of codeigniter 3.x from codeigniter website.
2. Download the Modular Extensions here: HMVC Pattern <a href=””>Download</a> ( )


Let’s go Step By Step

1. Extract Modular extension folder. You will find two folder there, the most important files is the core and third_party/MX folder.

2. Copy the Core Folder Files and Paste Inside Codeigniter Folder from application/core/. Core Folder contains MY_Loader.php and MY_Router.php files.

3. Copy Third Party/MX folder and Paste Inside Codeigniter Folder from application/third_party.

4. All of the main modular extensions that we need for our codeigniter HMVC 3.x is setup. Now, we need to test whether it is working or not. So, Go to your Codeigniter folder and Create “modules” folder inside Application

5. Using the folder “modules”, you can create different modules inside.

Note: Make sure when we run the codeigniter 3.x in local server without implements HMVC. It display welcome message.
6. Now, Let’s first check the welcome message in our local server with implements HMVC.

7. Create Folder “Welcome” inside “Modules”. Also create Controller and View Folders insides Welcome Folder.

8. Copy Welcome.php from Application/Controller to modules/welcome/controller/ .

9. Also Copy welcome_message.php from Application/view to moduels/welcome/view.

10. Check default controller is set in config/routes.php or not. If not set then set default controller to ‘welcome’ as below:

	$route['default_controller'] = 'welcome';

Finally, you can check in your local server. It will display you welcome message as same it is shown without using HMVC.


So now we already know how to implement HMVC Pattern in our Codeigniter 3.x Framework. You can now start creating your own cms or system using that pattern.

Tags: , , ,

Spin up a cloud server in no time flat

Simple setup. Full root access. Straightforward pricing.


Leave a Reply