WEReveal

Frameworks, CMS and Me

I have been struggling probably for over a year over a simple problem, which PHP framework should I use. The problem is rather simple at one level. I have been programming in PHP since… well I believe it was soon after PHP 3.0 came out although I didn’t fully make the switch to PHP from other web scripting languages until version 4.0 came out. As such, I developed my own framework rather early for the various projects I worked on. It is now in its fourth major version. But a year or so ago I kept hearing how it is so much easier to not work on your own framework, rather use a framework that is well supported and fully developed. I felt like if the “experts” are saying I should switch to some one else’s framework, I would.

I began pouring over frameworks, narrowing it down to six. I decided to test them by developing the same simple web app. It involved the standard display of data, a form, and CRUD database stuff. I tested each one for ease of use and good documentation primarily although I considered things like coding standards, support for multiple databases including Postgresql, support for the latest version of PHP, and good OOP practices in their own code. Some I didn’t even finish the test with, I just didn’t like they way they worked. I ended up with three finalist, CodeIgniterexternal_link, Zend Frameworkexternal_link, and Symfonyexternal_link.

I found CodeIgniter to be very easy with which to work. I developed the simple web app the fastest with it. I almost stopped my testing there because of those two factors. But as I looked at their code, I backed away. At least at the time I tested, their core code still was stuck in PHP 4 OOP writing standards. That really bugged me.

Zend Framework on the other hand took me the longest to get my head around. I was able to develop 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 thinking of trying it just to see. There is something appealing about using Zend Framework since you know they will be keeping up with PHP capabilities and clients might find comfort in knowing it is backed by the PHP guys. But as I said, I had troubles getting my head around it.

I ended up thinking I would settle on Symfony for my framework. I was able to develop my simple app relatively 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 writing my own SQL, I know, I am weird. I also like having complete control over how the database is configured and the ORM just can’t handle some of the more complex ways of relational databases. But, I have been working with Symfony on two different projects and pretty much grok the way it works.

And then along came a project that required a CMS first and foremost but also needed to have a lot of custom code added. Symfony CMS just isn’t there yet. I considered Drupal and Joomla. I haven’t quite groked how to create a module in Drupal… not very happy with their documentation. Joomla… well, I have worked on a module for it for several 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 looking at ModX Revolution (version 2 of ModX) and realized, “WOW! I can use ModX Revolution as a front end and a framework for the custom code on the backend.”

ModX allows one to easily add php code practically everywhere. Once you grasp the basics of ModX it becomes rather easy to create a fully functional custom site that has CMS capabilities that is easy for one’s clients to use to add/modify/delete content on their site. Admittedly, it took me a bit to grasp all the terms and concepts. Chunks, snippets, template variables, and the templating itself kind of feels overwhelming at first (not as bad as Drupal though). There are things missing from ModX that you find common in other CMSes but for a developer that wants a barebones CMS that you can add custom code to easily, it works well.

But then comes the problem, I wanted to use Symfony for my framework for the custom code. But both Symfony and ModX want to be the primary controller. I could have used most of everything that Symfony has to develop my custom 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 framework and developed the site quickly with ModX and without fuss. I realized at that point an interesting truth. All the public frameworks have to please a lot of different people for a lot of different reasons. As such, they become overly complex, not because they want to but because they have to be able to do everything for everyone. My own framework only has to please me and do what I need it to do.

I have always felt the main part of my own framework that was missing was the ability to give my customers easy to use, easy to understand CMS. My own attempts were somewhat clumsy. All I have to do is use ModX in conjunction with my framework and I have what I have wanted. Now, that doesn’t mean I am going to give up on Symfony. There are a lot of things that I feel compelling about it as a framework. I can probably make it work with ModX or other CMSes. When Symfony CMS is ready for primetime, Symfony may be all I need. But in the mean time, I am not going to neglect my framework. For me, it may always be the best.

Leave a Reply