Skip to main content

A nice little fine PHP framework called Yii

The origin

So, back in 2004 a new PHP framework named PRADO was created. Technically the framework is still active today but a) I have been coding in PHP for the last 20 years and never heard of it before doing some research for this post and b) their site is not even using SSL yet!!!

My point is, it may have been popular for some time for some people but it was never going to be the most successful framework around. So much that the original team, after only a couple of years, decided they could do better and create Yii instead.

First version Yii was released in 2008 and the rest, as they say, is written in the next paragraph.

The evolution

The first noticeable thing about Yii is that they’re not in a rush to release new versions. Check this:

  • 1.1 was released in 2010 and supported until 2020 with version 1.1.23
  • 2.0 was released in 2013 and technically still supported, with the latest version being 2.0.48
  • 3.0 has been “under construction” for a while, it’s marked as 84% complete and there is no release date yet

The features

Without going into too much detail, Yii framework has a neat arrangement of entry points, controllers, models, views, and so on.
It’s based on the Active Record paradigm, manage separate configuration files, supports extensions, and offer developer goodies like automatic collection filtering based on requests.

Overall, it can be used with satisfaction and it is a perfectly fine choice as a framework for your application.

Our take

As we’re talking about an open source project, let’s start by expressing our gratitude to all those who spend their time and give away their creation for free. A lot of businesses made a lot of money with projects based on Yii, and we ourselves are currently maintaining 4 API backends built with Yii 2 after upgrading them all from version 1.

That said, there’s something unsettling about such long release times. On top of that, Yii 3 will be “brand new” and that sounds definitely scary. What “brand new” means to me is, upgrade to version 3 will be a major rewrite.

So, here’s a few tips based on our experience and preferences:

  • if we had to start a new PHP project right now, Symfony looks like a better choice
  • if we had a very small and simple Yii 1 project, we would consider rewriting it with Symfony
  • if we had a large and/or complex Yii 1 project, we would require the help of Refactory (who else?) to migrate to version 2
  • if we had an Yii 2 project that is going to last for a while, we would not worry about an upgrade anytime soon, but we’d probably start extracting most of the logic into agnostic services that may be easier to migrate later on (we can help!)

Foto di Randy Fath su Unsplash