PHP Frameworks: Laravel
Posted on November 27, 2012
In the past few months, there’s a new framework that’s been taking the PHP world by storm. Laravel is self-described as a ‘framework for web artisans’, and what that really means is an intelligent framework that is well written, explanatory in its definitions, and overall one of the best ways to develop right now. I’m super excited to see what Laravel 4 looks like – but until then, these are my thoughts on Laravel 3.
Things I Liked
- Data modeling. Fluent is a really nice abstraction of querying the database, and Eloquent adds a light but powerful layer of ORM around that. Unlike the bloat of Doctrine, Eloquent objects are small and concise. Mapping relationships is easy, and although querying the related objects can be a bit verbose ($article->author()->first()->name) it’s worth the time.
- Routing. Laravel is built on top of Symfony components, and it uses some of the routing from there. Having the flexibility to define either anonymous functions for a URI and its verb, or to use a controller a la MVC, is a nice change that is also extremely useful.
- IoC. It took me awhile to wrap my head around how the inversion of control containers work, but once I got it, it made sense. And it’s wonderful.
- Bundles. The best part about Laravel is the way that it’s been embraced by developers, and that means third-party bundles to enhance functionality. It makes development a breeze.
Things That I Didn’t Like
- Forms and inputs. The built-in forms and input interactions are a bit awkward (having to use Input::old() and awkwardly pushing values into those), and it could be cleaned up. I’ve not used any of the bundles for forms, for what it’s worth.
- Singletons. This one is a bit nitpicky, but using singletons feels a bit outdated, perhaps. I think Laravel 4 is going to modify that functionality a bit, however.
- Templating. Overall I like the templating, but nesting views and having to wrap @section(‘content’) around my blade templates feels a bit clunky.
Honestly it was really hard to come up with things about Laravel that I don’t like. Overall it’s easily my favorite PHP framework, and I’ve been trying to do as much work as I possibly can in it. Phil Sturgeon, who worked on FuelPHP for awhile, jumped ship to help out with Laravel – so if that’s not a ringing endorsement, I’m not sure what is. Laravel 3 was great, and I can’t imagine that Laravel 4 will be anything less than incredible.