CodeIgniter-4.0.0-beta.1 recently released

I am delighted to say that CodeIgniter4 looks as though it will finally be released very soon and expect the final version sometime in April.

I have been playing with the numerous Alpha Versions and find that there are many very big differences to the previous versions. No longer a single Class, NameSpaces preferred for better performance and many other drastic changes. PHP7.2 is obligatory and very disappointed that declare strict_types is not being used. Updating old scripts is not easy and best to start from scratch.

1 Like

Say what? How do namespace help with performance exactly?

This is why you should decouple your own code from the framework, so that when framework gets an update you only have to change those few places where the coupling between your code and the framework occurs, instead of all over the place.

1 Like

Not to overly nitpick but this is not an update. For all intents and purposes, CI4 is a brand new framework. It shares it’s name with previous versions but that is about it. Basically the same as the Symfony 1 to Symfony 2 transition or the Zend Framework 1 to Zend Framework 3.

In that case you can view it as swapping out a framework, and I think my comment still holds, albeit to a lesser extent. The less contact areas you have between framework code and custom code, the less work you’ll have to do to upgrade/swap out a framework.

As an example, with Symfony using Doctrine ORM, don’t pass the EntityManager to any class that needs some database interaction; wrap instead in specific repositories with your own custom interface so that if the EntityManager ever has any BC changes, you only need to update the repositories, and not all your controllers, services, etc.

Of course all if this depends on what kind of project is, how big it is, what the expected lifetime will be, etc.

Please note I do not have an in-depth knowledge of Oop Classes and could very well be wrong…

The “No longer a single Class, Namespace for better performance…” was meant to be read together.

Code igniter was introduced about ten years ago and up until this latest version was based upon a single parent class. Inheritance of the parent class was frowned upon by PHP OOPS specialists. I believe Namespaces overcame the restriction by not having to load unnecessary classes and thus reducing memory used and better performance.

I endeavour to follow the decoupling advise with new code especially since I have been let down by libraries not being updated.

The following blog; written about two years ago, details many of the new features which need to be overcome. The Beta version has even more new features which need to be addressed!

Ah, that’s true; namespaces have certainly made loading classes more efficient since you can use PRS-0 and PSR-4. Which is not to say you couldn’t use similar techniques before using spl_autoload_register, but you’d have to manually define which class could be found where, which was kind of pain and led people to use Classes_With_Underscores that they could convert to be found in directory Classes/With/Underscores.

With PSR-0 and PSR-4 you just supply a namespace and a directory and any PSR-0 / PSR-4 loader (like the one composer has) will take it from there.

1 Like

Latest and possibly the last Beta version has just been released:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.