What are Modules in CodeIgniter 4?
Why Interviewers Ask This
This question targets practical, hands-on experience with CodeIgniter. Interviewers want to see if you've worked with these concepts in real projects, not just read about them. Strong answers include concrete examples.
Answer
CodeIgniter 4 supports a modular application structure where related controllers, models, views, and config are grouped together. Using CodeIgniter Modules (available via the codeigniter4/shield approach or third-party like myth/auth), each module is a self-contained namespace. Configure module locations in app/Config/Autoload.php under $psr4: "Modules\Blog" => ROOTPATH . "modules/Blog". Then create controllers at modules/Blog/Controllers/Blog.php with namespace Modules\Blog\Controllers. Modules improve code organization in large applications, allow code reuse across projects, and enable team members to work on independent parts. Routes for modules are typically defined in a Config/Routes.php inside the module directory. This approach is more manual than Symfony's bundle system but works effectively.
Common Mistake
Rushing to answer is a common mistake. Take two seconds to structure your response: definition → example → trade-off. This structure makes complex CodeIgniter answers easy to follow.