If you are looking for an easy to learn PHP framework, CodeIgniter is a great place to start. Yes, it’s comparatively easy to learn compared to some of the other PHP frameworks.
I’d also recommend exploring other PHP frameworks like Laravel as it has great popularity and a huge development community.
For the new developer looking to get up and running without too much of a barrier to entry, I would see CodeIgniter 4 (otherwise known as CI4) as being a good choice.
Confused about what PHP development is? See So what is a PHP Web Developer and what do they do?
Is CodeIgniter Dead in 2021?
No, CodeIgniter is definitely not dead. It’s alive and well. You can see on Github the CodeIgniter 4 repository has a hive of activity.
To note though, CodeIgniter is definitely not as popular as it once was. So you might want to take this into consideration when assessing which direction you want to go.
If you you want an easy to learn, light weight yet powerful PHP framework to learn in 2021 I would choose CodeIgniter 4.
Should I use CodeIgniter 4? Which Version Do a Choose?
CodeIgniter 4 is still considered a future version according to the Codeigniter website download page. Even though CodeIgniter 3 is considered the stable release, CodeIgniter 4 has been around for some time so in my opinion, I would be starting any new development projects on Codeigniter 4.
The structure and standards used in CI4 are more suited for PHP 7 and higher. Any new PHP projects should be running at least 7. At the time of writing PHP 8 is the current version. See the Supported Versions page for the PHP version life cycle on the php.net website. Not to mention security updates.
Is CodeIgniter Fast?
Yes, it sure is. It’s a very lightweight PHP framework that loads super quick. Now, this does have a couple of caveats. It does depend on how well the developer has written his code and server of course ;-). Well tested and structured code will deliver fast results!
How Long Does It Take to Learn CodeIgniter 4?
Well, this really depends on what PHP programming experience you have had. If you’ve had some limited experience with writing PHP. Let’s say you have experimented with some procedural code or doing some hacks with WordPress themes or similar. Without probably knowing it you’ve already got skills there that will be handy.
Given the above scenario I’ll say with some practice you should be starting to get a hang of the concepts after a couple of months. Although if you are completely new to PHP and potentially programming, I would suggest starting with more of the fundamentals of programming. Possibly with a more structured language like C or Java to learn better habbits before working with PHP.
How Does It Help Using a PHP Framework like CodeIgniter 4?
Great news! What you are going to find with moving onto a PHP framework is that it’s going to provide some structure to your coding. CodeIgniter 4 uses the MVC model or Model, View Controller to split up your code.
Here’s a basic overview of what each component does…
- Models – generally (but not always) this section contains the logic to interact with a database, eg INSERT, UPDATE, DELETE, ALTER, data etc. It contains reusable object data that you can use in the main controller.
- Views – These are more or less template files that use a mish-mash of dynamic PHP data and HTML, CSS, JS, etc. The Controller uses one or more view files to render output to display to the browser.
- Controllers – This is where your main page logic runs from. Essentially the controller will call on data from the Model/s and prepare that data to be used with a specific view file/s.
There are other sections to the CI4 framework like Libraries, Config, Helpers but this gives you the basic idea. Best to see the Models, Views, Controllers page on the CodeIgniter website for a more detailed explanation.
Can I Learn PHP Without Knowing HTML?
Yes, for sure. Although taking into consideration a lot of real-world projects, you are likely to come across and use HTML at some time. It’s also quite common for PHP to be embedded in with HTML in template files when displaying to the browser. After all, HTML is more about visual formatting rather than programming.
A suggestion for someone that mainly wants to concentrate on the backend development logic that PHP offers, is to use HTML helper functions that are included with CodeIgniter 4.
HTML Helpers will allow you to use HTML in a more programmatic way. Rather than having to know the HTML tags and their exact syntax structure and attributes HTML tags can be generated by easy to use functions.
Form Helpers are also extremely useful when creating HTML forms and can save a lot of time compared to writing a whole heap of HTML. Especially when working with a lot of array data.
What Is the Difference Between CodeIgniter 3 and 4?
There is a big difference actually. The jump from CodeIgniter 3 to 4 involved a total rewrite of the framework. There are still familiarities but there are a lot of differences too.
If you are new to PHP frameworks and you are trying to decide what version to learn, I would suggest going straight into Codeigniter 4. Even though CodeIgniter 3 is the current stable version, CI4 has been released for a while and quite stable. It adopts more of the modern features of PHP 7+ like namespaces and uses better security practices. I would only suggest starting with CodeIgniter 3 if you are looking at maintaining older sites developed in Codeigniter 3.
Main differences between CodeIgniter 3 and 4
|Item||CodeIgniter 4||CodeIgniter 3|
|Server Requirements||PHP 7.3+||PHP 5.6+|
|Directory Structure||different to 4|
|.env File Support||Yes||No|
If you are trying your hand at upgrading an application written in CodeIgniter 3 to CodeIgniter 4 you’ve got some work to do! Depending on the size of the application of course. The CodeIgniter website gives some directions on upgrading from 3 to 4 on the Upgrading from 3.x to 4.x page.
Further Resources to Start Learning CodeIgniter 4
15 Part Video Tutorial on CodeIgniter 4
Is CodeIgniter 4 Easy To Learn? The instructor Alex Lancer takes you through a 15 part video series showing CodeIgniter 4 is, in fact, easy to learn. He explains the main things you need to know to get up and running. Suitable for beginners or developers wanting to upgrade your skills from CodeIgniter 3 to CodeIgniter 4.
Official CodeIgniter4 User Guide
If there is anything you need to look up to reference the official CodeIgniter User Guide is the place to go. For more practical hands-on examples though, it’s probably better to view the video tutorials to see how a demo application is built. It may put things in a clearer perspective.