How to Create and Run a CodeIgniter Project
This is an introduction tutorial for one of the popular PHP framework CodeIgniter.
CodeIgniter, one of the famous PHP Framework for creating PHP MVC Projects. The first version of CodeIgniter was released on Feb 2000 and which is still popular on these days. This is a RAD (Rapid Application Development) PHP framework, enables you to make your PHP codes structured with MVC model.
What is MVC?
MVC stands for Model View Controller. There are the three main parts of the three tire architectural projects. Instead of writing PHP codes, HTML design and database codes in single page, MVC enables you to write all three parts in separate three files.
M – Model => Contains database related codes such as connections strings, SQL queries, etc.
C – Controller => Contains main core codes of PHP.
- Rapid development
- Structured coding
- Reduce code complication
- Well performance
- Coding simplicity
- Reduce future correcting complexity
Before starting to learn the framework, you should understand that, this is a PHP framework. So you must learn the basics of the PHP programming language such as server side scripting, local hosting software like WampServer, Basic PHP codes, etc.
First of all, you need to download the basic framework kit of CodeIgniter from their official site. Try to download their latest version.
- You will get a zip file.
- Now just turn on your WampServer (or local hosting software) and open your local host folder ‘www’.
- Extract CodeIgniter files and rename the folder with your new project name. (Look at the picture, renamed with ‘myproject’).
You have to use separate CodeIgniter files for each projects. So keep your master files safe.
Now if you open your folder, then you can see like this:
If you can see again another folder with name CodeIgniter, then just make your folder arrangement like above for better coding.
- Now installation is over.
Just look at ‘Application’ folder, this is your master folder. Open the folder, now you can see many folders including your MVC folders such that Models, Views and Controllers.
Running a CodeIgniter Project
You can run your project like running a PHP plane project.
- Open WampServer localhost.
- Now just click on your ‘project folder name’. Sometimes you might type ‘localhost/yourprojctname’. Here: ‘localhost/myproject’. Then hit enter key.
- Now if you get like this, then your CodeIgniter framework works well, if else, you got some error while installation or running.
Let us start to write coding in next lesson.