Fat-Free, a new PHP framework

Posted by on February 26, 2010
 

The newest player in the ever growing market of PHP frameworks is the PHP Fat-Free Framework (also called F3). The framework is a real lightweight; the basic functions are embedded in one file, one class, consuming only 39kb of disk space. This basic functionality includes a very simple to use Router, nifty template system and an easy-to-use SQL Handler. Everything you need to start creating a site. An important advantage of the framework is that the only requirement is PHP 5.3+. No PHP PECL modules, no PEAR libraries, no external classes nor third-party components. It’s all there, in one class.

Since this framework is quite new there are almost no tutorials available yet. Don’t let that scare you off, the documentation on the site is excellent. It’s on the same page as the one linked to above (if you don’t see it, scroll down). Contained within the download is also a handy quick reference card that lists all the functions. Also included in the download file is a file called F3ex.php which contains some extra’s like a CAPTCHA generator.

Using PHP 5.3 gives F3 the advantage of namespaces. As long as you put your functions in different files you can name the same since the framework wraps each file into their own namespace. Variables are also in these namespaces, so using the same variable name in different pieces of your code is possible without getting bugs you can’t figure out how to fix.

Taking the Fat-Free concept even further they provide an automatic way to compress Javascript/CSS with their F3ex.php expansion pack. Even the filesystem becomes lighter — F3 does not enforce a file structure unlike other frameworks do.

One thing is sure, this framework is anything but usual, yet it is very usable. I think we will see some great and smooth running, sites made with this framework in the future.


About the author—Marco is the keeper of keys and Chief Garbage Collector at Blue Parabola, php|architect's parent company. He can be found on Twitter as @mtabini.