DEV Community

Cover image for 10 differences between CodeIgniter 3 and 4

10 differences between CodeIgniter 3 and 4

Jonathan Lamim on March 04, 2020

Before we talk about the differences, we need to know a little bit about what happened in the time between the release of version 3 and the version...
Collapse
 
blair2004 profile image
Blair Jersyer

I likes this framework a lot ne cause it was simple and effective when I was starting php. Then I learned new stuff and I wanted more tools Ci3 couldn't offer.. I've found laravel... And I'm not going back. I'm however wishing them a good luck with the version 4

Collapse
 
prahladyeri profile image
Prahlad Yeri

Nice write up on the new features of CI4!

Having said that, most of them aren't really applicable in context of small PHP shops or freelance programmers like me. For example, I hardly ever use namespaces in PHP as classes suffice for most of the work.

And I also don't have a habit of using a huge list of composer dependency packages. For the rare ones that I do, I've configured autoloading for them and use those projects as baselines for future ones.

Entities are a nice feature but existing database models in C3 do the job too. Me personally, I don't even bother with models but prefer to deal with sql queries directly using $this->db->query($sql). It's a lighter and faster approach with much less clutter!

Performance aspect is interesting but performance will largely depend on the PHP version which is used, not the CI version. If I'm using PHP 7.2+ already, it shouldn't matter whether I use CI 3 or 4 as both should give the same performance.

As regards the large number of config files in CI3, the simple approach here is to create a one-time baseline project with your config preferences, and then start all other projects from there. This method has served me well over the years and I've never had to look back.

Collapse
 
cdsaenz profile image
Charly S.

Great article, still relevant. I've used CI3 for many, many years. And watching CI4 from a distance, testing it now and then. Also Laravel. It took me the time for me to grow into Namespaces and modern PHP in general (which I started using in CI3). One thing to mention in favour of CI4 is advanced inheritance (Base Controllers and Models). I did a lot of that in CI3 and had to do some awful tweaking. In CI4 it's natural PHP, Namespace/use, a simple class in Libraries. I won't migrate my CI3 stuff which works fine (and tightly secured once moved all the code out of www root) but now I'm ready to start new projects with CI4. It also resembles the awesome Laravel: CI4 is like a lightweight/less opinionated Laravel. All are valid choices.

Collapse
 
gabrieldevops profile image
gabo

CodeIgniter 4 Fantastic!!! wit PHP 7 and with PHP 8 JIT , poooowered

Collapse
 
mumingazi profile image
Mumin Gazi

Nice work!

Collapse
 
gunnrcrakr profile image
gunnrcrakr

When CI 4 will release offial ?

Collapse
 
jonathanlamim profile image
Jonathan Lamim

The official release was released on February 24th.

dev.to/jonathanlamim/codeigniter-4...

Collapse
 
benayapaul profile image
Benaya Paul

Good Article was more informative between CI 3 vs CI 4.
Thanks

Collapse
 
faisal95bd profile image
Faisal-95

good article!

Collapse
 
miguelgomezsa profile image
Miguel Gómez

Hi Jonathan, I disagree with you in 8#. CI 3 have a little initial configuration. The same like CI 4.
In the rest of points I am fully agree.
Regards

Collapse
 
jonathanlamim profile image
Jonathan Lamim

Thank you for your feedback Miguel! Is there any other difference that was not mentioned here and that you have already encountered it?