By Harry Fuecks

More PHP frameworks

By Harry Fuecks

Yes I know – with the framework in progress, we don’t need no more stinkin’ frameworks. Except there’s a couple I’ve seen recently which are noteworthy. I haven’t delved into the source code in any depth – exploring framework code bases has become as much fun as watching paint dry, but there are some interesting ideas here, if you’re looking to new angles on the problem.

First up is Tonic by Paul James which labels itself as “A RESTful Web App Development Framework”. It’s interesting because the API of the controllers you write is much like which I covered before here (and tonic actually came first). Some interesting ideas – and it’s one of very few paying attention to HTTP. You’ll need to pull it out of CVS BTW (no download at this time).

Second in todays framework fiesta is Code Igniter (thanks to Mark Barton for the tip off) – this is from the same people that put together pMachine hence think it’s noteworthy. It’s very Rails-esque from superficial trawling but it’s appealing to the KISS point of view, plus there seems to be a cunning approach to URL mapping in there.

Any – that’s it – for me never another framework again. If you have a burning desire to waste time, try here or here. Otherwise, one PHP framework to rule them all.

  • I’ve been playing with the Zend Framework since the day the preview release arrived and, well… I think I’m in love :) Its coded well, documented well, and really captures the essense of what a framework is supposed to be. It gives you so much for so little.

    I love the fact that, when I look at the ZFW’s source code I understand it, and in fact find myself slapping my forehead saying “Why didn’t I think of that?” It’s so powerful, yet so incredibly simple. The PHP community could really benefit from some of the lessons one can learn from the Zend Framework.

    What it needs now is a code-generator :) Does anyone know if this is in the works?

  • C Drozdowski

    Your little Tolkien-ism at the end was, probably unintentionally, an interesting double entendre.

  • poncho

    For those of us stuck on “affordable” shared hosting with no PHP5 I love the look of Zend Framework but look at it more in a philosophical light, since I won’t be able to use it any time soon.

    I have tried Code Igniter and it looks pretty good, quick and easy to get going and it does have quite a nifty URI mapping method. I’m giving CakePHP a good going over at the minute, it seems to be very powerful. This is the first time I’ve had a chance to take a serious look at frameworks in general so I’m open to suggestion ;)

    By the way Harry, thanks for PHP Anthology, one of a very few programmers books that a regular person can read and comprehend!


  • That’s not entirely true that you can’t get PHP5 hosting affordably. You can’t blame the majority of shared hosts for not upgrading yet, as it would break a vast amount of sites they host whose owners won’t bother to update their code. But there are hosts that support it already.

    But for those of us who are ready to move on and embrace the power of PHP 5, solutions do exist :) I got sick of waiting for my old host to update, so I went out and found one that supports PHP 5, latest stable release. I switched to A2 Hosting for a variety of reasons. First, they support PHP 5. Second, they were more than happy to setup certain extensions that my site required, such as the PDO Postgres extension. Third, they support not only MySQL, but PostgreSQL as well. Give them a look, I think they’re worth every penny I pay them.

  • LiQ

    Please, could the dude managing the .NET-blog post an equavalent article on this very interesting subject.

    At least one post per month, is that too much to ask?

  • mwmitchell

    I second A2 Hosting! Great hosting for the past 3 1/2 years!


  • I still think we both need as many frameworks as possible (to avoid being stuck into a single-minded outlook), while at the same time we need none at all (because we don’t need most of what they offer for our actual programs).

  • Personally I need a framework, wether it be Zend Framework, Cake, or one I made myself. Because without one I’ll be forever reinventing the wheel :) Without good frameworks and libraries we programmers spend more time writing boring but neccessary, cookie-cutter code, and less time solving interesting problems or creating unique products.

  • ninja, that’s my point exactly. We need our own frameworks, based on our specific needs and purposes and composed of elements from various other libraries and frameworks. No “general-purpose” framework will cover all of our needs, while it will certainly offer quite a lot that we’ll never use.

    With this in mind, what we need is a better version of PEAR and (with more PHP5-specific classes), as well as independent libraries like ezComponents.

    And of course that’s why we desperately need namespaces.

  • poncho

    Thanks for the suggestion coffee ninja, I’ll have to check them out. I’ve actually been looking for a UK-based PHP5 host for a while to no avail – I have quite a number of domains on my reseller account, some of which must be hosted in the UK for legal reasons.

    I did give DreamHosts’ reseller package with PHP5 a try but cancelled after 3 weeks. I was not impressed with the performance of the server, ie. it was dog slow.

    I understand the point of view of hosting providers in that most of their customers will probably not know or care about the differences between PHP4 and PHP5, it’s easy money in that respect. The few UK-based PHP5 hosts that I have found seem to be charging a good bit extra for that privilege, or their setup is mediocre :(

    I’ve pretty much accepted that I’m going to be without PHP5 for the foreseeable future.

  • poncho,

    Its sad that we’re probably still going to be waiting for PHP 5 adoption when PHP 6 is released :( I honestly think the only way we’ll get hosting providers to support PHP 5 is to get the packages up-to-date that the “I don’t care about PHP 5 Clan” uses. It sounds truley silly, but its the truth :) If 4 out of 5 customers at a host are using the service for WordPress/Gallery//Coppermine/whatever, when those packages all support PHP 5 telling that 1 other customer to update his code or face problems should be less of an issue.

    Perhaps I am oversimplifying, but I think the popularity and widespread adoption of some of these fantastic packages has become a bit of a double-edged sword :) And if you crack open the hood of something like WordPress, a package that is popular despite its code and not because of it, you can see its a long, long road ahead.


    I absolutely agree with you that “a general-purpose framework cannot cover all of our needs, but will probably offer quite a lot that we’ll never use.” That’s another thing I’m liking about ZFW to be honest :)

    Zend Framework isn’t all that I need and never will be. If someone else was writing all of the code I need, well… I’d soon be out of a job. But if I need new functionality, the Zend Framework gives extension points, interfaces to implement, and plenty of information on how to do it.

    Zend Framework does, admittedly, offer more than I need. But the Framework has been written in such a way that it doesn’t force itself on you, and doesn’t require you to use its classes when another solution is available. Want to use PEAR::Mail instead of Zend_Mail? Fine by them… Zend Framework is lightweight and extensible, just as any good framework out to be.

    Of course just because Zend is working well for me (so far), doesn’t mean that your points aren’t valid. But for me, ZFW is “just enough.” :)

    As for namespaces, god yes we need them. Zend Framework “fakes them,” but someonewhat inelligantly by using long class names. I can’t wait till we get this in PHP 6!

  • amen

    I love stinkin’ frameworks. Without we could do it better. The world would smells very booring without all this stinkin’ stuff. That’s evolution.

    The stinkin’ dev of billons of code lines

  • Arnaud

    One small note

    At one can read

    Adds slashes to POST and COOKIE data in the event get_magic_quotes_gpc is disabled.

    I do not think it is such a good idea.

  • Etnu

    For those of us stuck on “affordable” shared hosting with no PHP5

    Why still this myth?

  • In regards to LiQ’s post, the reason why you’ll find less framework’s available for the .NET platform is because the whole environment is object-orientated by nature.

    Alot of the projects I build, the majority of the functionality will be contained in classes (pagination,database,validation,ajax calls, webservices), that I can compile into one DLL and then use accross many different web,command-line,XAML and windows applications.

    Regardless of the language, frameworks are also great if you’re working for yourself, but remember that when you’ve pushed yourself in one direction for the last 5 years… how would that reflect when applying for a new job? Would the framework be so abstract from it’s parent language, that you may not actually be programming/solving important concepts for yourself anymore?

    Futhermore, consider accountability and support or the lack of it.
    Are you truely going to be able to unlock the full potential of someone else’s framework?

    By all means, write your own… so far I’ve built for php and converted it for c#, wasn’t too difficult, and c# has enabled me to code for all platforms/scenarios, so this framework is allowing me to build applications alot faster than before.

    I built a whole community site this month in less than 2 weeks (blog/articles/tutorials/cms/forums)

  • kyberfabrikken

    Tonic is interesting indeed. Thanks for the link Harry.

  • elliotonehouse

    Seems strange that there is no mention of the Symfony framework here. I don’t have a lot of experience looking under the hood of different frameworks, but after having spent a couple of weeks messing around with Symfony, it looks very solid on a lot of levels, and worth checking out.

    I get that the Zend framework will essentially be the “framework to rule them all”, however, a primary concern for me is the quality of the framework’s documentation. I don’t have a lot of faith that the Zend Framework project will produce quality documentation any time soon (maybe that’s unfair… just the feeling I get). Symfony on the other hand has some of the best documentation I’ve seen, and a great project tutorial to help you learn the diff aspects of the framework.

    On another note, I don’t really see digging into “yet another framework” as a waste of time. Even if you don’t end up using the framework, it can be an edifying experience walking through the codebase and learning how the developers have tried to solve some of the classic application development issues. That said, of course, I guess if you have Harry’s level of experience, you’ve seen it all a few times before, and perhaps checking out a new MVC framework won’t reveal anything new.

  • In regards to questions about Zend Framework’s documentation, keep in mind what we are seeing now is a “preview release.” I would hope too that the documented comes together a bit better when we approach a 1.0 release.

    On the flip side, the documentation they already have is quite good. In addition the guys behind PHP have done a bang-up job on the PHP documentation, and if we can expect something of that calibur we’ll be in good shape. And finally, the code is quite self documenting. I’ve been simply opening up a file in PHPEclipse and letting it tell me method signatures.

  • Benjymouse

    LiQ, Chris Ward

    You don’t see the battle over frameworks in the C#/.NET world simply because most of the bases are already covered by the MS .NET Framework: Graphics/drawing, XML processing, web services, forms/form controllers, masterpages, templating, authentication, authorization, membership, personalization, I18N, localization, data access, logging/diagnostics/tracing, extensibility, configuration, output caching, data caching, regex’es.

    MS also has a very productive Patterns & Practices group. They produce the “Enterprise Library” which can be viewed as an add-on library which takes some of the above areas even further.

    The point is, faced with the completeness and quality of the official frameworks, alternative frameworks have a very hard time gaining a foothold.

  • chrisb

    Which poses the question of why the open source community isnt embracing mono more than it does now.. international standard development across all platforms would be nice wouldnt it?

  • Gozer

    A good code generator would be a good next step for PHP. Yes, there are several projects that generate code (mostly DOA’s), but I think they fall a little short of what *enterprise-grade* code generators do in the C++, Java, and .Net world. Being able to go from a UML diagram to nearly complete PHP code with the click of a button is invaluable. One thing I’ve learned from building my own xml-to-php code generator is that it’s a topic that will likely be as varied and contested as frameworks are now. One size will probably not fit all.

  • Gozer

    Oops… that’s DAO’s! PHP Code Generators

  • John

    I feel somewhat like Harry in that all of these new frameworks are overwhelming. After looking at severeal I think Symfony shows the most promise. I have played around with so many frameworks I just want to stick with one (probably Symfony) and never look at another one. Maybe that would be a bad idea but I just can’t keep up with all of these new ones. Why are we, as a community, re-inventing the wheel with a new framework everyother week? I suppose new approaches are good and will help bring out new ideas, but I feel that some of these frameworks could of helped in the development of others and incorporated their ideas in existing ones.

  • On another note, I don’t really see digging into “yet another framework” as a waste of time. Even if you don’t end up using the framework, it can be an edifying experience walking through the codebase and learning how the developers have tried to solve some of the classic application development issues. That said, of course, I guess if you have Harry’s level of experience, you’ve seen it all a few times before, and perhaps checking out a new MVC framework won’t reveal anything new.

    It’s more that sense of despair I get on running into stuff like this…

    Adds slashes to POST and COOKIE data in the event get_magic_quotes_gpc is disabled.

  • Simon

    I’ve spent quite some time on different frameworks and found that none actually perfectly fit my need. So i took all the ideas i like from different frameworks and basically wrote a framework my own.
    At this moment, I don’t really care about frameworks that offer bunch of things i don’t need, i just sniff around for things and ideas that is useful. Then i only have to spend an hour or so to write something similar and add in to my framework.

  • Just thought I should point out Drupal as another great alternative. Open source (GPL), works with PHP 4 and 5, highly modular and extensible. Although Drupal is actually a CMS, and is called a CMS or a community blogging tool by most people, it actually has a very clean separation between its core system, and its various modules that are responsible for content management.

    The core system of Drupal is increasingly coming to be known as the “Drupal framework”, because it is possible to disable all of Drupal’s application-specific features, and to build a custom app on top of its extremely light core. Development is also moving towards making the core even lighter, and there is much talk of releasing the app-specific modules only in targeted distributions, rather than in the base system.

  • Patrick Breitenbach

    CodeIgniter looks the most promising to me since it’s so much lighter weight than the others (Symfony looks incredibly heavy to me and dependent on at least three other projects).

    I think we actually have it pretty good in the PHP world vs. .net where we have different framework options including not using a framework at all.

  • Patrick Breitenbach

    Harry and Arnaud, could you elaborate on what the issue is with “Adds slashes to POST and COOKIE data in the event get_magic_quotes_gpc is disabled.”

    The creator of Code Igniter has this to say about it:

  • Host your own site

    1&1 and possibly other hosting companies support php4 normally and php5 if you use the php5 extension or an .htaccess file. Its easy to set up on apache, maybe your host already does.

  • attila

    Let me post some links to PHP5 hostings.
    I really do not understand you guys why do you look in USA for web hosting if there are plenty of excellent web hosting companies in East Europe like Czech Republic, Slovak Republic.
    My client is from Holland and he has a hosting at A2 Hosting in USA (actually they were the first to offer PHP5 hosting). The problem with almost all USA web hosting companies is that their server is extremely slow, or expensive.
    A2 Hosting for example all the time restarts its servers, at leat I believe. It happened several times that the web site was down for a few minutes.

    So let me reveal a secret. You will find much better web hosting companies, many times cheaper, in Europe than in USA. You west European guys should learn to trust the new EU members.

  • cacooma

    I like typo3. It’s very powerful and flexible and provide you with wealth of plugins and libraries. Makes life easier for any expreinced developer.

  • Alex

    If you’d like to try out yet another Framework in PHP, you can take a look at PHPWebBuilder. It supports object relational mapping, a component-based MVC, and transparent AJAX support.

  • Ixzat

    @attila: It doesnt matter to me where my servers are located, but atleast i need to understand the language the company uses that im going to be hosting my sites with. I dont speek checkish or slovenian…

  • kjwa

    Tonic has a lot of extremely good ideas in it, and deserves much more buzz than it gets IMO!

  • Ivan

    Yo may consider this one too – QPHP. It is ASP.NET like, object oriented, event driven, component based, ajax support, i18n support, highly customizable.

Get the latest in Front-end, once a week, for free.