Frameworks, CMS and Me

I have been strug­gling prob­a­bly for over a year over a sim­ple prob­lem, which PHP frame­work should I use. The prob­lem is rather sim­ple at one lev­el. I have been pro­gram­ming in PHP since… well I believe it was soon after PHP 3.0 came out although I didn’t ful­ly make the switch to PHP from oth­er web script­ing lan­guages until ver­sion 4.0 came out. As such, I devel­oped my own frame­work rather ear­ly for the var­i­ous projects I worked on. It is now in its fourth major ver­sion. But a year or so ago I kept hear­ing how it is so much eas­i­er to not work on your own frame­work, rather use a frame­work that is well sup­port­ed and ful­ly devel­oped. I felt like if the “experts” are say­ing I should switch to some one else’s frame­work, I would.

I began pour­ing over frame­works, nar­row­ing it down to six. I decid­ed to test them by devel­op­ing the same sim­ple web app. It involved the stan­dard dis­play of data, a form, and CRUD data­base stuff. I test­ed each one for ease of use and good doc­u­men­ta­tion pri­mar­i­ly although I con­sid­ered things like cod­ing stan­dards, sup­port for mul­ti­ple data­bas­es includ­ing Postgresql, sup­port for the lat­est ver­sion of PHP, and good OOP prac­tices in their own code. Some I didn’t even fin­ish the test with, I just didn’t like they way they worked. I end­ed up with three final­ist, CodeIgniterexternal_link, Zend Frameworkexternal_link, and Symfonyexternal_link.

I found CodeIgniter to be very easy with which to work. I devel­oped the sim­ple web app the fastest with it. I almost stopped my test­ing there because of those two fac­tors. But as I looked at their code, I backed away. At least at the time I test­ed, their core code still was stuck in PHP 4 OOP writ­ing stan­dards. That real­ly bugged me.

Zend Framework on the oth­er hand took me the longest to get my head around. I was able to devel­op the app but it took me almost 4 times as long as it did with CodeIgniter. I haven’t tried the test with Zend Framework2 but I am think­ing of try­ing it just to see. There is some­thing appeal­ing about using Zend Framework since you know they will be keep­ing up with PHP capa­bil­i­ties and clients might find com­fort in know­ing it is backed by the PHP guys. But as I said, I had trou­bles get­ting my head around it.

I end­ed up think­ing I would set­tle on Symfony for my frame­work. I was able to devel­op my sim­ple app rel­a­tive­ly quick once I grasped the Symfony way of doing things. The one thing I didn’t do was go all out with Doctrine ORM. I like writ­ing my own SQL, I know, I am weird. I also like hav­ing com­plete con­trol over how the data­base is con­fig­ured and the ORM just can’t han­dle some of the more com­plex ways of rela­tion­al data­bas­es. But, I have been work­ing with Symfony on two dif­fer­ent projects and pret­ty much grok the way it works.

And then along came a project that required a CMS first and fore­most but also need­ed to have a lot of cus­tom code added. Symfony CMS just isn’t there yet. I con­sid­ered Drupal and Joomla. I haven’t quite groked how to cre­ate a mod­ule in Drupal… not very hap­py with their doc­u­men­ta­tion. Joomla… well, I have worked on a mod­ule for it for sev­er­al years. I know Joomla but quite frankly, don’t like it as a CMS. The project was to replace a ModX Evolution site so I got to look­ing at ModX Revolution (ver­sion 2 of ModX) and real­ized, “WOW! I can use ModX Revolution as a front end and a frame­work for the cus­tom code on the back­end.”

ModX allows one to eas­i­ly add php code prac­ti­cal­ly every­where. Once you grasp the basics of ModX it becomes rather easy to cre­ate a ful­ly func­tion­al cus­tom site that has CMS capa­bil­i­ties that is easy for one’s clients to use to add/modify/delete con­tent on their site. Admittedly, it took me a bit to grasp all the terms and con­cepts. Chunks, snip­pets, tem­plate vari­ables, and the tem­plat­ing itself kind of feels over­whelm­ing at first (not as bad as Drupal though). There are things miss­ing from ModX that you find com­mon in oth­er CMSes but for a devel­op­er that wants a bare­bones CMS that you can add cus­tom code to eas­i­ly, it works well.

But then comes the prob­lem, I want­ed to use Symfony for my frame­work for the cus­tom code. But both Symfony and ModX want to be the pri­ma­ry con­troller. I could have used most of every­thing that Symfony has to devel­op my cus­tom code but that was going to take a bit of effort and time which I didn’t have. As such, I slipped into using my own frame­work and devel­oped the site quick­ly with ModX and with­out fuss. I real­ized at that point an inter­est­ing truth. All the pub­lic frame­works have to please a lot of dif­fer­ent peo­ple for a lot of dif­fer­ent rea­sons. As such, they become over­ly com­plex, not because they want to but because they have to be able to do every­thing for every­one. My own frame­work only has to please me and do what I need it to do.

I have always felt the main part of my own frame­work that was miss­ing was the abil­i­ty to give my cus­tomers easy to use, easy to under­stand CMS. My own attempts were some­what clum­sy. All I have to do is use ModX in con­junc­tion with my frame­work and I have what I have want­ed. Now, that doesn’t mean I am going to give up on Symfony. There are a lot of things that I feel com­pelling about it as a frame­work. I can prob­a­bly make it work with ModX or oth­er CMSes. When Symfony CMS is ready for prime­time, Symfony may be all I need. But in the mean time, I am not going to neglect my frame­work. For me, it may always be the best.

Leave a Reply