Let me preface this blog with the following: I have been a programmer for the past 12 yrs and have used php for nearly 8 yrs, ZF1 for nearly 3 yrs (10+projects) and ZF2 since its inception. So, I understand the framework(s) quite well and have given it a fair amount of trial time.
About 2 months ago, I stumbled upon the Laravel framework. A couple of hours into studying Laravel, I had an epiphany : This is what all other frameworks should strive to be! Easy, Functional, modern and completely out of the way. While its CodeIgniter underpinnings are easily discernible based on the folder structure and config files, it is quite a radical departure in terms of the underlying code. Laravel 4 in particular embraces all prevailing best practices in the PHP world.
In comparison, both ZF1 and ZF2 are complicated, and require a steep learning curve. I kid you not, I was up and running with Laravel 4 in about 3 hours! (properly understanding my first “hello world” with ZF2 took me a week).
In my humble opinion, ZF2 is over-engineered, demanding more attention than the actual web application at hand. The reliance on (deeply nested) arrays for everything from route configs to parameters makes coding a chore. See, while arrays are speedy and flexible, they are a debugging nightmare. You get pretty much Zero IDE support (autocomplete, code completion etc). You have to remember verbatim all the required keys (I kind of got around this using netbeans code templates.But the templates became so many in number that remembering those presented a problem!).
Two projects later, I can confidently say that there is nothing that I can do in ZF2 that I can’t do using Laravel 4 (and in lesser time). The fact that L4 ties into composer/packagist means that pretty much any open source php project(on packagist) can be utilized in a Laravel project. In fact, L4 uses ‘monolog’ for logging, ‘swiftmailer’ for emailing and ‘symfony’ for the HTTP core and command line interface. All while providing a very ‘laravelesque’ approach to coding. There really are no limits. Very cool indeed!
Although I feel a certain closeness with ZF due to the sheer amount of time I spent with it, I feel the time is right to switch to L4 for future projects. I think L4 has done a LOT of things right, and deserves credit for it. The Eloquent ORM is very easy to work with. Routing in Laravel is an absolute joy! It does much of the heavy lifting when it comes to RESTful interfaces.
Form management is beautifully implemented. It is trivial to implement custom form/html controls.The DI mechanism is very expressive.So are Filters and Events. The Blade templating engine has an uncanny resemblance to the Razr engine used by ASP.NET MVC (which I really like!).
Although it looks like L4 uses an abundance of static methods, in reality it harnesses the __callstatic() php magic method to actually load objects from the DI container. The L4 command line tool “artisan” is also very well executed. Unit testing is very simple and works right out of the box (no lengthy setups required prior to running phpunit).
L4 has indeed improved my productivity quite dramatically 🙂