CodeIgnitor 3 vs 4
CodeIgniter 3 vs CodeIgniter 4
CI is one of the famous and MVC of very small footprint, easy to manage and small in file size and very fast among other PHP framework.
here we gonna understand what is difference between CI 3 and CI 4
we can download CI 4 in two ways either be conventional method like CI 3 (Download Zip file and run) and another is using Composer.
CI 4 is developed int PHP 7.2+ version so it follows Namespace but not others where as CI 3 does not follow any of the namespace.
CI 4 has its structure organized in 5 directories: /app
. While CodeIgniter 3 is organized in 2 directories:/application
- We have to extend \Codeigniter\Controller instead of CI_Controller in CI 4
- We do not use any constructor to use CI magic
- It’s more powerful than the CI3 as it is using Request and Response object for working.
- We can create controller anywhere and all we have to do it to extend controller.
- CI model you have to extend \Codeigniter \Model.
- writing in CI3 $this->load->model(x) now you have to write $this->x = new X():
- CI4 has Entity class also to use richer data mapping to database tables;
- writing in CI3 $this->load->view(x) you can use echo view(x);
- CI4 supports view cells to build your responce in pices.
Then $this->load->library(x) now you can use $this->x = new X();