Fat-Free Framework for PHP

One thing I enjoy is when a technology just works. I personally find that most PHP frameworks try and extend themselves too far into complete solutions, trying to solve the problems few people have at the expense of complexity. This is why I have written my own frameworks over and over. Each time iterating over the model and trying to improve the performance and sensibility of the system. Even though I am pretty proud of my efforts, late last year I stumbled onto a framework that really caught my attention, the PHP Fat-Free Framework. It has the elements of simplicity I feel really allow a developer to push out code quickly. It's very well thought out and feels very tornado-like in it's design style. One problem I have always had with PHP frameworks were their lack of a good routing solution.

I like python, however, one issue I have with the general attitude of pythons core development is it's inability to accept that it too has flaws, even with some of it's core libraries. These are often dismissed when discussed as something you just need to work around and I find it hard to swallow the pill that just because it's more structured than PHP, the problems with the core (anyone who has used datetime and had to deal with timezones and mongodb cannot say there are no flaws in python) are not acknowledged well enough, or even documented well enough, to make coding as pleasant as I feel it could be. That being said, I did enjoy using twisted as a web framework. It had the simplicity in it's design I was looking for. It also is very powerful, and is probably the default framework I will go with for any python-based project I work on.

With all that in mind, I am a PHP developer, and I found Fat-Free to be a breath of fresh air. I finally feel I don't need to write a new framework and really have a place to begin all my future projects. Fat-Free PHP 5.3+, which is what I try to write everything in now. I like namespaces, even if the syntax is a little annoying, I understand the intention and the reasons we have to go with ye olde backspace. I also feel that web page rendering and routing fits very well with OOP and having a stronger OOP core in 5.3 is key.

Fat-Free, to me, feels very similar to tornado in it's framework design. You define your routing in the main file and it's all handled by included classes. The automatic importing of your classes is very easy to understand, and the routing is extremely simple yet powerful. The ORM tools provided are at least good enough to do anything you really need to, however, if it's not to your liking you just don't use it. I love that about F3. Nothing but the core is required. I like Smarty, especially V3, and I use it whenever I can. Even though the built-in templating supports a lot of the same features, I can do everything I need to do in Smarty, and I am more comfortable with extending it and it's syntax. As with the ORM libraries, you simply don't use f3 and you're off and running with whatever you want to use for rendering your pages.

So check it out. I would like to see your feedback and hear your feelings on the overall state of PHP frameworks.


  1. Fat-Free does indeed provide multiple well measured utility classes. But the licensing is unfit in this day and age. The GNU GPL is inappropriate for libraries, but asking for donations and still giving out proprietary versions is just nervy.

  2. What do you mean "proprietary versions"? AFAIK, it's all in CVS.

  3. er, it's all in sourceforge. haha.

  4. There is no and never will be a large community around a framework that is licensed GPL. It means that all projects that use it MUST be GPL.

    If you want to charge money for your awesome framework, charge for printed documentation or professional support, not the actual framework itself(must pay to use the framework in a non-GPL fashion).

    Pick any well known PHP/Python/Ruby/Javascript/Java framework, they are all BSD/MIT PERIOD!

    It is a good way to become obsolete and fringe...

  5. Yeah, Linux is pretty damned fringe¡ Drupal isn't used by anyone and has no community what-so-ever¡ Trolls don't exist on the internet, either¡

    And no, it doesn't mean that all projects that use it must be GPL. It means that if you ever sell your product, the people you sell it to have a right to the source code as well as the product. This doesn't mean that you need to release the code for, say, a service you design and use the framework. Also you only need to give the code for the modifications to the GPL'd code or any code you have written that makes the GPL'd code not functional.

    I like the BSD/apache/MIT licenses more, but it doesn't make your random trolling valid.

  6. @b: You should read the website. It states "[...] permissive and "closed-source" licensing terms are available. For more details, please contact [...] -- and this right after asking for donations.

    I disagree with the other Anonymous post. While charging just for support is the better option, charging for downloads would be acceptable in my book too. It's allowed by the license (which is called the "GNU GPL" btw), and would be way more upfront. The sneaky asking for donations and selling proprietary license behinds contributors backs is not (but true, someone else set the precedent there).

    What's most fascinating about this is that it's relly just GNU GPL projects that do that. Projects under academic licenses are seldomly that perky. Which led me to assume the license is often just chosen by popularity, not understanding the social mandate.

    (Drupal is another good example, but let's not stroll offtopic.)
    Fat-Free is a nice framework, but with that license it's not going to be very widespread. It doesn't matter if any extra rights are required, but more freely licensed and more encompassing frameworks exist en masse.


  7. @b: Yeah, Linux is pretty damned fringe¡ Drupal isn't used by anyone and has no community what-so-ever¡ Trolls don't exist on the internet, either¡

    Linux is an OS. A complete standalone entity. You install it runs and does something.

    The same would apply to Drupal, a complete CMS system.

    My whole post was about Frameworks. I believe nearly every sentence had framework in it.

    Using GNU GPL does mean that all derivative works must be similarly licensed GNU GPL. Read the license. While enforcement of the license and interpretations of wording is up to lawyers, no one is going to take the risk of building something with GPL in a commercial situation.

    My points are all valid and your are just plain misguided.

    @Mario, yes charging for downloads is a good option too. But in the end, anything that deters mass acceptance will not be successful or widespread.

    Will Fat Free ever have a large self sustaining community? Will it have a vibrant open development and upgrade roadmap? Go to the site and compare what the site offers in terms of community involvement and compare that to any other framework/project.

    I do think it is a good framework and offers a lot for its footprint.

  8. Actually, Linux is a kernel and does very little useful by itself. The kernel is a great analogy for a framework. Your code is not written in the framework, it is referenced by the framework and makes use of the framework. All your code is not written in the framework, but runs on top of it, much like an OS runs on a kernel.

    "no one is going to take the risk of building something with GPL in a commercial situation" is provably wrong with the hundreds, if not thousands of companies doing exactly that. It's grandstanding and trolling and a weak understanding of the GPL license.

    Again, I am not a fan of the GPL but I know it's limitations and it's actual impact and for something such as a web framework, it's perfectly fine. If you are making a sellable, installable software product, then yes, you would need to license it under the GPL to the people you license it to. That simply means you must provide the source to everyone you sell it to. Particularly in a PHP project, I have seen very few useful projects distributed as compiled PHP.

    What it doesn't mean, which is implied by your statements is that you must release the source for everything you write that a customer uses on your servers. This is simply not the case and I would love to see an example that proves me wrong.

  9. All these anonymous posts are stupid rants on a legal issue they barely understand. Seems like some people confuse freedom with free beer. Everyone wants everything, but nobody wants to pay the bill. Unless someone here has a degree from a reputable law school to boot, I suggest we leave the legalese to the lawyers.

    @b: I totally appreciate this review and the analogy.

  10. You know about the bug with captcha ()?
    It's easy to fix!
    Line number 81 in graphics.php with the error:
    $ file = self:: $ global ['FONTS'].

    Corrected version:
    $ file = __DIR__ .'/../ fonts / '. self:: $ global [' FONTS '].

  11. Maybe this is a dumb question, considering the path of comments above (I won't claim to have any deep understanding of the GPL at all), but why is there no sample code on this post?

    And for that matter, on several posts that I've found on F3. It seems lots of people have talked about building stuff with it, but not many people have actually done it. Is that just 'cause they don't want to claim that they have? It'd be a shame for such a great product to go unused.

    Final question... if the GPL is so bad, can anyone suggest a competitive framework to F3 in weight, size, ease of use... which ISN'T under GPL?

  12. For those of you watching this space, I am going to give lexa-tools (http://blog.amartynov.ru/?p=535) a look next.


  13. This is a nice article..
    Its very easy to understand ..
    And this article is using to learn something about it..

    c#, dot.net, php tutorial

    Thanks a lot..!

  14. FatFree 2.0 has arrived