What is the difference between CodeIgniter 3 and CodeIgniter 4?
Answer
CodeIgniter 4 is a complete rewrite of CI3 with modern PHP practices. Key differences: CI4 requires PHP 7.4+ (CI3 supported PHP 5.6+). CI4 uses namespaces and PSR-4 autoloading (CI3 used a custom autoloader without namespaces). CI4 has a proper HTTP layer with Request/Response objects (CI3 had a single Input class). CI4 has built-in migrations and seeders (CI3 had a simpler migrations library). CI4 has a Model class with validation and callbacks (CI3 models were bare). CI4 uses Filters instead of CI3's Hooks. CI4 has first-class CLI support via Spark. CI4 is Composer-first (CI3 was typically downloaded as a zip). CI4 supports dependency injection via Services. The application code structure changed significantly — CI3 apps cannot be directly migrated to CI4.