Codeigniter Introduction and flow of MVC
- Codeigniter Introduction and flow of MVC
- Codeigniter directory structure and role
Codeigniter Introduction and flow of MVC.
CodeIgniter is a powerful PHP framework with a very small footprint, built for developers who need a simple and elegant toolkit to create full-featured web applications.
You can find complete resource for codeigniter here https://codeigniter.com/
What is MVC ?
Codeigniter Introduction and flow of MVC.
MVC stand for Model, View, Controller.
Model -> Model contain code related to database queries. Basically it is a layer between database like (MSSQL, MYSQL) and business logic.
View -> View contain presentation logic like , html, css and javascript files,
Controller -> Controller is very important part of any MVC structure. Controller contain business logic of any application which will be implement on database.
How MVC works in Codeigniter
1. In Codeigniter application When we hit url or any route like: www.mysite.com/home
2. Then in this case home keyword is route name or may be a controller name like (homeController.php). So when we type such url in browser url bar in any codeigniter application, this action will be call corresponding controller.
3. In second step the corresponding controller will call associate model file.
4. And Model file will connect to database and fetch related information from database and will send return to controller.
5. In last step controller will send these data to view (presentation file) and view will display all related information on browser.
6. And finally the lifecycle of MVC in codeigniter will be finish.
Codeigniter Versioning
Currently we are using codeigniter version 3 .
But new version on codeigniter version 4 in development phase.
You can fine this repo on this link https://github.com/bcit-ci/CodeIgniter4
In the next tutorial we will learn about
1. Directory structure
2. How to create Model, View, Controller.
3. How to add static files like css, and javascript.
4. How to deploy on local server.