10+ years developing with Yii

Way back in my simple programming career, I kept reinventing the same wheel with every project: routing, user session management etc. At one magnificent evening of insight, I decided to sit down and learn a solid framework to use for all future projects. As these things go, the framework comparison turned out to be a project on its own, but after some trail and error the hammer  landed on the Yii framework. Yii standing for “Yes-it-is”, answering the question “is this the right framework for me?”, while also meaning simple and elegant. It turned out to be a great choice; I still use Yii for most projects 10+ years after, and want to elaborate a little on why that is.

Why it’s great

The main reason it’s simple: it provides most common tools needed for web projects, in a relatively easy to learn package. It scales from initial idea to medium-sized (100k+ users) projects without hassle. And being PHP it doesn’t lean on magic (as beautifully described by this HN user). Magic is great early in a project but always turns into a fight later on, something my Django projects usually suffer from. A sensibly structured Yii project however can be happily running untouched for 5 years, after which new features can be added surprisingly easily.

After running one of the main tutorials and playing around for half a day, even the programmer who was unfamiliar with MVC is ready to go and build their first app. Most core features are available as expected but only when needed: caching, ORM, utilities and what not. Compared to i.e. Laravel, it lacks the enormous eco system with plugins, extensions and tools (as well as the “look-how-beautiful-I-am” attitude). This seems like a major disadvantage, though in practice this rarely seemed like a hurdle as long as one is sticking to the fundamental idea’s of the framework.

Nothing without drawbacks

Nothing is perfect, and neither is Yii. The advanced template for Yii2 was quite a disaster in practice (something you find out 2 months into a project). The way anything HTML related is configured (key-value array style) makes life harder than it should be. As the framework is not amongst the most popular (perhaps 5th or so?), extensions made by other users are often non-maintained. The default Gii generated models are okay, but can greatly be upgraded by using something from kartik-v, whom’s extensions are a huge upgrade over Yii’s defaults overall. Tooling for migrations are definitely not as user-friendly as Laravel’s, or Django’s, but sufficient overall.


Personally, I’m not too optimistic about Yii’s future. Somewhere back in 2018, plans were made for a new version. Many of its plans seem to evolve around becoming PHP-FIG complaint; a movement with the aim of standardizing features in PHP frameworks, making them more interoperable. The idea is great in principle, though its member list has some of the most impressive names under the “former members” header.

Apart from FIG, there are some decent idea’s in the roadmap, but none excite me enough to be interested in the v3. A lot of the targeted “issues” seem to resolve around being more flexible; allowing the user to choose any architecture and pick the components desired. This counters what I like about Yii2: there is a solid, predefined MVC structure that lays the foundation upon which you can build. Any (relatively standard) Yii2 project will have the same foundation. Yes, it forces some decisions (which after all is the strength of a framework), if they are not to your taste perhaps Yii is not for you.

The result 4 years later; 80 out of 126 parts for Yii3 are ready, with some of them not being touched for over 700 days. The 212 line composer.json is a monster unsuitable for any starting template, and the general structure seems to be departing so far from Yii2 that an upgrade becomes a rewrite.

Respect and many obvious thanks for the developers that put all efforts into Yii3. Hopefully they see the vision that this simple blog-poster is missing. What remains, however, is a huge collection of packages, 4+ years in the making and far from finished.

Perhaps it’s better to stick with Yii2 for the near future, and hope the continuing community efforts pay off in the long run. Happy coding!