Why Laravel?
I consistently get asked why Laravel should be used over CodeIgniter, Fuel, {insert another framework here}. Here are a few reasons off the top of my head:
It’s expressive.
Do you know what the “true” flag does in this line of code?
$uri = Uri::create('some/uri', array(), array(), true);
Furthermore, do you have any idea what any of those parameters do besides the first one? Of course you don’t. It’s not expressive.
Expressive (adj.): Effectively conveying thought or feeling.
Let’s try another line of code:
$url = URL::to_secure('some/uri');
This creates a full URL that uses the HTTPS protocol. Actually, both methods accomplish the same thing. Which one is more expressive?
Expressive code is maintainable code.
Getting up to speed on unfamiliar code is much faster when the code is expressive. It’s also a breeze to maintain expressive code since the code is accurately conveying the actions it is performing. The code is obvious.
In fact, this is actually one of my coding “rules”. I almost never expose a boolean flag on a method. If you have a boolean flag on a method, you can always make another method that is more expressive.
It’s simple.
Really, the web is pretty simple stuff. It’s just request - response. I told myself this over and over again when building Laravel. I just want a simple way to catch requests and send out responses. That’s it. Sinatra style routing nails this.
Route::get('home', function()
{
return View::make('home.index');
});
But, of course, we need to do other things like validation, pagination, etc. All of this is simpler in Laravel. No crazy configuration files. Want to paginate some users while eager loading their posts? Sure:
$users = User::with('posts')->paginate();
echo $users->links();
Notice what you didn’t have to do. You didn’t have to tell Laravel what page you’re currently on, and you didn’t have to create some ludicrous pagination configuration file. You’re done. You’re creating, not plumbing.
It’s accessible.
CodeIgniter is popular because it has great documentation. It’s very accessible. Kohana is a technically superior framework to CodeIgniter, but guess what? It doesn’t matter. It doesn’t matter if Kohana is better because its documentation is horrible.
I promised myself never to release Laravel until I had great documentation, and I never release a new version until the documentation is totally up to date. Any PHP programmer can pick up Laravel and start using it in a matter of minutes. The expressiveness of the code itself and the great documentation truly make coding enjoyable.
Cool kids are in the community.
Laravel seriously has an awesome community. It’s one of the things I love most about the framework. People are polite, friendly, and helpful. There are no egos and I’ve never seen anyone be insulted for not knowing how to do something. Heck, I’ve even jumped on Skype a few times to talk to random people about a problem they were having. If you’re on IRC, be sure to stop by #laravel on Freenode.
So there is my quick pitch for Laravel. I’ve truly enjoyed working on the framework, and hope you enjoy using it.