CodeIgniter 4

CodeIgniter is the first web framework that I learned and used. It was CodeIgniter 2 (or maybe 1 I forgot) and still using PHP 5. The first framework that taught me MVC (Model View Controller) and web development instead of using a CMS (Content Management System) software such as WordPress, Drupal, Joomla, etc. It filled my childhood.

In this era of modern web development, I found some startups or digital products in CodeIgniter. Some of them are still in the oldest version, CodeIgniter 2 and PHP 5. They stay because the source code grew so much caused hard to maintain.

PHP has changed so much better. From 5 to 7. It has many features, performance improved, and new syntax. In frameworks, there are Laravel, Lumen, and Symfony as competitors for CodeIgniter.

Not interested in PHP? You can create REST APIs for the headless application using Go or JavaScript (NodeJS), the popular ones. You also can try Python Django, Ruby on Rails, Java Spring, or any MVC framework that you like.

The point is to upgrade your technologies to create qualified digital products. Refactor the source code, not just adding more features. Stay is just making the development getting worse as long as the new features growing. It is not only bad for the product, but also the team. The CodeIgniter itself losing its community. From EllisLab to British Columbia Institute of Technology. Today, at the PHP community, Laravel is the most popular framework.

CodeIgniter 4 is a modern lightweight PHP framework and the latest version of CodeIgniter that currently under development. It is not ready for production yet, but I have tried it. It was awesome.

Requirements Minimum PHP 7.2
Installation Composer
Development
  • Simple CLI command, php spark serve.
  • Environment variables, .env. You can set up the database configuration for local development and change mode from production to development.
Debugging
  • There is a toolbar at the bottom of the screen that shows useful information.
  • New helpful error pages.
Controller There is a BaseController.php that you can extend for your controllers instead of extending CodeIgniter\Controller directly. You can put any piece of code there so any children can have it to avoid repetition.
Routing
  • The old route is not accessible if the new route defined.
  • Good for REST API.
Structure The structure is well restructured and understandable.
Services All classes of CodeIgniter are services.
Security The documentation has security guidelines based on OWASP recommendations. So, as a developer, you don't need to confuse about securing your app using CodeIgniter.
Logging You can log information to the local log files.
Seeding Database seeding is a simple way to add data into the database. It is useful during development.
Honeypot It is to determine whether a bot or human makes a request.
Throttler It is to limit an activity to be performed to a certain number of attempts within a set period of time. It is most often used for rate limiting on APIs or preventing brute force attacks.
Testing Finally, we can perform automated testing using built-in PHPUnit.
CLI We can make custom CLI commands. It is different to running via CLI commands.

CodeIgniter is lightweight. CodeIgniter 4 is modern, more lightweight, and having more features. Maybe it will take the PHP community from the Laravel.

References