»
S
I
D
E
B
A
R
«
Fluency: a minimalistic HMVC web framework for PHP 5.3
March 13th, 2010 by fluency

The Fluency framework is a minimalistic web framework for PHP 5.3. Its only purpose is dispatching HTTP requests and providing the developer a way to handle them following the MVC architectural pattern. Hierarchical MVC (HMVC) is supported out of the box, meaning that separate sections of the served content can be provided by multiple controllers.

Example action codeFluency takes some inspiration from functional programming. Actions (controllers), views and action filters are all internally represented as functions. This provides many advantages, for example, views can be composed like mathematical functions: compare the function composition f(g(x)) with the composite renderer "layout + post".

Because actions (controllers) are also functions and can only return a single value, the use of hierarchical MVC, that is, using separate actions to provide separate sections of the content, is highly encouraged, also helping to achieve a proper separation of concerns.

Generally, Fluency favors convention over configuration, but the conventions are not hard-coded and can be easily changed. The resolution of action, view and action filter names is a responsibility of resolvers, which are, again, functions, which reside in the application bootstrap script and can be easily replaced.

As already mentioned, Fluency aims to be lightweight and avoids reinventing the wheel as much as possible by including only the most basic functionality, that is, request dispatching, URL routing, rendering and action filtering. If that matches your attitude towards web frameworks, you should definitely give Fluency a try!


One Response  
  • mario writes:
    July 13th, 2010 at 7:02 pm

    I like some of the ideas in Fluency. Very interesting. Not sure if I like annotations. Why not put it as code? What is the advantage of using annotations like

    /*
    * resultView: layout + box + index
    */

    instead of code? Most IDEs have refactoring facilities which would not work with annotations. This seems as readable:

    resultView = pipe(array(’layout’, ‘box’, ‘index’));

    Also, I’m not understanding the advantage of treating each action as its own file. Most of the time a controller acts as a container for common logic between actions. For example, retrieving data from multiple domain models can be shared by the same action.

    Anyway, I like that Fluency takes a different approach and interested in why you made these decisions.


Leave a Reply

»  Substance: PHP Frameworks   »  SiteMap