PHP Micro-Framework

Few days ago I was searching for a RESTful PHP framework to help me develop a little project of mine. As I was searching, I stumbled upon PHP micro-framework. At first I didn’t know what that means, but as I dug deeper I saw some new ideas, new ways to develop a web application.

As you know, I have experienced with several PHP frameworks before, but all of them have many things in common: MVC, Controller-Action mapped to route, etc. When I read about micro-frameworks, they don’t enforce you to any fixed architecture. You could build your own architecture, they only provide the basics such as routing and database wrapper, thus the name “micro”.

But just like PHP frameworks, there are many PHP micro-frameworks. One of the oldest is Limonade, too bad it’s not actively developed anymore, i think. The other name I stumbled upon is Slim Framework, one of Sinatra-inspired framework, quite good. Then I found Fat-Free Framework, which some article said “tiny script with real muscle” or what I may say “kecil kecil cabe rawit” in Indonesian.

A bit about Fat-Free, I like how it provides people with many “getting started” guides so new people could understand how to use it. Also, it has many features despite having such small size. I happened to read all those guides and done some “hello world” using Fat-Free. But what I dislike is how it uses PHP eval() function. I checked there are about 10 occurrences of eval(). But I’m going to keep Fat-Free as my backup choice for my project.

Next, I saw Laravel, a new PHP micro-framework with “Clean & Classy” slogan. At first I notice how it also provides good getting started guide like Fat-Free. Even tough it has less feature, it didn’t use any eval(), so a big plus in my opinion. When I skim through Laravel source code, I realize how beautiful it is written. Laravel uses latest PHP technology like anonymous function and namespace very well. For example, let’s see a portion of Eloquent (Laravel’s ORM) class:

<?php namespace System\DB\Eloquent;
	use System\DB;
	use System\Str;
	use System\Config;
	use System\Inflector;
	use System\Paginator;

	abstract class Model {

When I saw this, I was like “This is the one!”.

The only downside of Laravel is that the fact it’s still new (started about June 2011) so it still need many improvements, especially its ORM. But I saw a bright future and I think I’m gonna use Laravel for my project.

Next? I’m gonna write a simple blog tutorial using Laravel.


One thought on “PHP Micro-Framework

  1. Don’t be fooled by the generalization that “eval is evil”. eval can be used properly with controlled data (non-user provided input).

Leave a Reply

Your email address will not be published. Required fields are marked *