Browse By

CodeIgnitor 3 vs 4

Spread the love

CodeIgniter 3 vs CodeIgniter 4

ci version

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

Downloads:

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.

Technology:

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.

Structure:

CI 4 has its structure organized in 5 directories: /app,/system,/public,/writable,/tests. While CodeIgniter 3 is organized in 2 directories:/applicationand/system`.

Controllers:

  1. We have to extend \Codeigniter\Controller instead of CI_Controller in CI 4
  2. We do not use any constructor to use CI magic
  3. It’s more powerful than the CI3 as it is using Request and Response object for working.
  4. We can create controller anywhere and all we have to do it to extend controller.

Models :

  1. CI model you have to extend \Codeigniter \Model.
  2. writing in CI3 $this->load->model(x) now you have to write $this->x = new X():
  3. CI4 has Entity class also to use richer data mapping to database tables;

Views:

  1. writing in CI3 $this->load->view(x) you can use echo view(x);
  2. CI4 supports view cells to build your responce in pices.

Libraries :

Then $this->load->library(x) now you can use $this->x = new X();

Leave a Reply

Your email address will not be published. Required fields are marked *