Monday, December 31, 2007

PHP Frameworks

Part of my decision to create Fleventum was the realization that I had little exposure to any of the PHP frameworks I kept hearing about. I consider myself to be a fairly competent PHP programmer, but found my lack of experience with a MVC framework in PHP to be a bit disappointing.

The PHP Framework landscape is quite cluttered at the moment, and sorting your way through the various blogs/forums out there comparing them is equally confusing. Part of me wishes that there were fewer choices, but all of me wishes all of the choices were a bit more mature.

I'll try and clutter the landscape a bit more with my own opinions on some of them, but first let me list some of my must-haves from a framework:
  • Object-Oriented. Since PHP 5's rework of classes, I have been using them extensively and can barely exist without them.
  • Easy View implementation. I'm tired of writing Javascript & HTML. Make it as easy as possible, implementing OO to its full extent.
  • Flexible Model implementation. I'm willing to give up some ease-of-use when it comes to the Model, if it means a lot more flexibility. I am a competent SQL writer and database modeller, so if I wish to implement something complex in the database, the Model must allow it.
  • Should have as many of these features as possible: user authentication, access control lists, robust session handling, database independence, easy SOAP/REST implementation, easy and robust AJAX.
  • Robust, complete documentation
  • Responsive user community
  • No separate templating system! PHP does a sufficient job of templating, especially if the data and view components are simple enough. I don't want or need to learn Smarty or something else.

Zend Framework
A bit less than what I would consider a framework. More like a group of a bunch of libraries. Has classes for handling many of the common web tasks (authentication, database, sessions, etc), but lacks the View implementation I desire. I really wish to make UI stuff super easy.

Cake
Cake seems to be very full featured, and I keep coming back to it every couple weeks hoping I was wrong in my last impression. It's View implementation seems very immature.

Symfony
One of Symfony's strongpoints seems to be the Model layer. It utilizes a third-party ORM module for implementation of much of the Model layer. Currently they are using Propel, but it appears they will be switching to Doctrine. Both libraries look very nice, even supporting things like Presorted Traversal Trees (complex parent-child relations). Once again, though, it appears its View implementation is weak. Reminds me a bit of the CGI module in Perl.

Prado
Prado was my first choice for a framework. It made things like scaffolding very easy, had some nice looking View controls (HTML text area, for example), and very easy data binding for controls. I like its View and Controller implementations. At first, I really liked its Model implementation, but after I spent a couple days with it, gave up on it. They offer two different methods of implementing the model- Active Records or SQLMaps. From the documentation, it appears you can combine the two, which would provide a near perfect implementation. But I had lots of difficulty doing so. Also, while the project has decent documentation, their user community appears to be limited. One of my biggest complaints about Prado is it felt like I wasn't programming in PHP anymore. Prado is still one of my top choices for a PHP framework, and I may revisit it at a later date.

QCodo
I have currently settled on QCodo, but I'm not far enough in to say with any certainty that I won't give up on it as well. QCodo is a bit unique among the frameworks, in that it is a code-generating framework. This means that you point it at your database and it generates the code to access it for you. However, when it generates code, it generates it as two classes. The "generated" class and then a template for your implementation. The generated class can be re-generated any time you wish from the database (add a field to the table in the database, regenerate the code, and the new column is available in the corresponding object). The template class it creates subclasses the generated class, so you can reimplement or augment and functions you wish. This makes it easy to implement business logic at the model layer without actually touching the database layer. QCodo's View & Controller implementations are also very nice. HTML elements are created as objects. AJAX enabled controls are written exactly the same way as non-AJAX controls. I encourage you to view their AJAX dashboard demo.

In the end, none of these frameworks meets all of my needs and desires. QCodo's major shortcomings include lack of authentication and access control and a lack of flexibility on the model layer. So, I am going to piece together the framework I want. Use QCodo's View and Controller layers, Doctrine for the Model Layer. Additionally, I will attempt to utilize some of the classes in the Zend Framework, notably the Authentication and Access Control modules. I will post updates as my work progresses.

Fleventum

My Fleventum project has begun. This has been a goal of mine for a while now, and active development has begun. The road ahead is not easy though, as my goals are fairly lofty.

Before getting into my goals for this project, let's discuss the history. A little over a year ago, I was asked to research issue tracking software for my company IT department. We had previously been using an extremely limited in-house product. Naturally, I first went looking for open-source products. There are quite a few out there, Bugzilla, Trac, Mantis, but none of them really were what I was looking for. I looked at some commercial offerings and liked quite a bit about Jira, but it is very expensive, especially for the full-featured enterprise version. I eventually came across Eventum from MySQL. I liked that it was written in PHP, and a cursory glance at the source led me to believe that I could easily tweak it to my heart's content. So we decided upon Eventum and I spent a couple weeks working on migrating our existing data to it, and adding a bit of functionality to it.

Six months later, a new version of Eventum was released and I realized that merging its changes with mine would be very difficult. So, we are "stuck" with the version we have. We like the version we have. It is but a few tweaks away from being a very nice product for our needs. It has been my experience that issue tracking isn't quite as "one-size-fits-all" as the vendors of expensive commercial versions might lead you to believe. The needs of a 10 developer shop are quite different than of a 50-developer shop and different from an open-source project.

But, I continue to hear gripings from managers and other types about our current system. Occassionally the sentiment becomes "Jira would fix that". I often ask that desired improvements should be noted and I should be given another couple days to make them at some point, but these requests are often unanswered.

Eventually I though, hey, wouldn't it be great if there was something that combined the best features of Eventum and Jira and was open-source (or at least much cheaper)? And thus Fleventum was born.