CodeIgniter

Francesco Ciannavei

CodeIgniter

CodeIgniter is the PHP framework I have the deepest experience with. At STCC I moved about 40 controllers of the software used to draft legislation for the Chamber of Deputies and Senate from CodeIgniter 3 to CodeIgniter 4, and from PHP 5 to PHP 8.

The CodeIgniter 3 to 4 migration

CodeIgniter 4 isn't an update of CodeIgniter 3: the structure, the namespaces and many APIs are different, so code doesn't move across as it is. I chose to go one controller at a time: I copied a controller into the new project and fixed whatever was missing or outdated (first the missing models, then updating them to the new standard, then the views, then the helpers) until that piece worked, then moved on to the next. The new version reached staging while I was at STCC; when I left, it hadn't gone to production yet.

What broke on staging

Bringing CodeIgniter 4 to staging surfaced two problems. The first was a 404 when CodeIgniter runs in a subdirectory with indexPage set: I proposed a fix in pull request #9607, which was closed without being merged. The second: some CodeIgniter 3 helper functions no longer exist in CodeIgniter 4, and I reimplemented them. The debugging behind both is described on the debugger page.

Technical skills

I know CodeIgniter's MVC architecture well, the routing system, managing custom libraries and helpers, the Query Builder and the Active Record pattern, caching, session handling and CodeIgniter 4 middleware.

Pull requests in the CodeIgniter ecosystem

  • CodeIgniter4 #9543: added application/octet-stream to the stl MIME type in the Mimes config. Merged.
  • CodeIgniter4 #9621: fixed outdated documentation on excluding multiple test groups. Merged.
  • CodeIgniter4 #9607: the proposed fix for the subdirectory 404. Closed without being merged.
  • Shield #1282: completed the Italian translations of the authentication package. Merged.

To work on the migration in DDEV, I also added a CodeIgniter 4 project type to DDEV: that story is on the Docker page.

The front end of a RAG app

Also at STCC, CodeIgniter 4 was the front end of a RAG app: it proxied requests to a Python API that handled embeddings and chat.

Rating
8/10

Where i've used it: