What is CI4's auto-routing improved?
Answer
Auto Routing Improved (CI4.2+) is a safer version of auto-routing that maps URLs to controller methods without requiring explicit route definitions. Enable: $routes->setAutoRoute(true) in app/Config/Routes.php. URL: /controller/method/param maps to Controller::method($param). Key security improvements over the old auto-routing: only methods explicitly prefixed with the HTTP verb are accessible (getIndex() for GET, postStore() for POST), parent class methods are not accessible, the method must accept the correct number of parameters. This prevents accidental exposure of internal methods. The route list: php spark routes shows all accessible auto-routes. For new projects, explicit routes are still recommended for clarity, but Auto Routing Improved is a much safer option than the original CI3/CI4 auto-routing for rapid development.