Technology leadershipPeople · Systems · Delivery

Notes

PHP5 min read

Getting things done with Yii 1.1

A client, a deadline, and a framework called Yii. Why I stopped writing plumbing, started shipping — and first noticed the problem that would become a company.

A client needed a student records system — admissions, attendance, fee tracking — and the budget said "one developer, six weeks." Two years ago I would have written it in raw PHP: a folder of .php files, each opening with mysql_connect and a prayer. This time I bet the project on a framework called Yii, and I want to write down why I'm not going back.

What a framework actually buys you

The skeptics in the forums say frameworks are slow and bloated, and that real programmers write their own. What I found instead: Yii's Gii generator gave me working create-read-update-delete screens for every table in a single afternoon. ActiveRecord means I write Student::model()->findAll() instead of concatenating SQL strings — and the SQL injection holes I used to patch one mysql_real_escape_string at a time simply aren't there to patch.

The framework isn't writing my application for me. It's stopping me from re-writing the same fifty solved problems for every client.

The unglamorous parts of 2012

Deployment remains FileZilla and nerves — drag the folder onto shared hosting, refresh, hope. The client's office machines run Internet Explorer 8, so every jQuery flourish gets tested against it and half of them die there. And I've learned to keep dated zip backups of the whole project folder, because "version control" on this job is me and my external drive. (Colleagues keep mentioning git. It's on the list.)

Six weeks later

Delivered on time: admissions, attendance registers, fee vouchers, a CGridView report the principal can filter himself. The client thinks I'm a magician. The truth is less romantic and more useful — I stopped writing plumbing and spent the weeks on the actual problem. There's something in this school-management domain, by the way. Every school I visit runs on paper registers and one overworked clerk. Someone is going to build the system they all need.