I recently pushed an update to CI Twig, a Codeigniter library I created back in 2012 for integrating the Twig templating engine. Twelve years. That’s older than some of the junior developers I’ve worked with. It’s wild to think that something I built when I was still figuring out what I was doing has been sitting there on GitHub this whole time.
CI Twig was one of my first proper open source contributions. Not my first bit of code on the internet, but one of the first things I put out there with the intention of other people actually using it. I remember being nervous about it. What if my code was rubbish? What if someone found a bug and called me out? What if nobody used it at all?
Turns out, people did use it. Not millions, but enough that I’d occasionally get an email or a GitHub issue from someone who’d integrated it into their project. That felt good. Still does, honestly.
The update brings CI Twig into the modern era with support for PHP 8.1+ and Codeigniter 4.6. The original version was written for Codeigniter 2, back when we didn’t even have Composer and you just dropped files into an application folder and hoped for the best. Different times.
Working on this update reminded me how much I genuinely love Codeigniter. I know Laravel gets all the attention these days, and it’s a fine framework, but there’s something about Codeigniter’s approach that just clicks with my brain. It’s lightweight. It stays out of your way. You don’t need to learn seventeen different concepts before you can build a simple CRUD app.
When I was starting out as a developer in the early 2010s, Codeigniter was the framework that made PHP make sense to me. I’d tried a few others and bounced off them hard. Too much magic, too much configuration, too many assumptions about how I wanted to structure my code. Codeigniter just let me build things.
The ergonomics were (and still are) excellent. Want to load a model? $this->load->model('user'). Want to grab something from the database? The Active Record pattern made queries readable without hiding what was actually happening.
Need to send an email? There’s a library for that, and it works how you’d expect it to work.
I built so many projects with Codeigniter. Client work, side projects, stuff that’s long since been retired, and stuff that’s somehow still running in production somewhere. Each one taught me something. How to structure an application. How to think about separation of concerns. How to write code that other developers (including future me) could actually understand.
PHP itself gets a bad reputation, and I get why. There’s a lot of terrible PHP code out in the wild. But modern PHP is genuinely pleasant to work with. Type hints, attributes, enums, match expressions, named arguments. It’s come a long way from the PHP 4 days of everything being a global variable and error handling being an afterthought.
I still reach for PHP when I need to build something quickly. Not everything needs to be a React SPA with a Node backend and seventeen microservices. Sometimes you just need a server that renders HTML, handles form submissions, and talks to a database. PHP has been doing that for three decades and it’s gotten pretty good at it.
Updating CI Twig was a nice trip down memory lane. Looking at code I wrote twelve years ago was humbling. Some of it was genuinely not great. But some of it was better than I remembered, and the core architecture held up well enough that modernising it wasn’t a complete rewrite.
If you’re using Codeigniter 4 and want Twig templating, CI Twig is still there. It’s got template caching, module path auto-discovery, custom function and filter registration, and all the other bits you’d expect. Install it via Composer like a civilised person, unlike 2012 me who was still manually copying files around like a caveman.
I don’t know if I’ll be updating this library again in another twelve years. But if 2038 rolls around and PHP and Codeigniter are still kicking, maybe I will. Stranger things have happened.