I’ve been using Laravel for a few months now and am really enjoying it. Perviously I was using Kohana as my PHP framework. But after a little time with Laravel I just didn’t feel like going back to Kohana for new stuff. I can’t put my finger on it exactly but Laravel just feels good to work with.

Admittedly I have a rather bland title but the Laravel site blows it’s own trumpet quite loudly by itself:

A Framework For Web Artisans

Laravel is a clean and classy framework for PHP web development. Freeing you from spaghetti code, Laravel helps you
create wonderful applications using simple, expressive syntax. Development should be a creative experience
that you enjoy, not something that is painful. Enjoy the fresh air.

Actually this put me off at first – I was expecting overly simplistic features in the name of ‘clean’ code and a lot of mmm our cool aid is tasty. But once I started using it I found it to be a well thought out, well documented php framework with a lot of nice features and a decent community around it.

One of the things that really put me off of Kohana was it’s appalling documentation. The forums were full of comments like look at the source and the documentation on the site was often hidden behind old versions, if it was there at all.

Laravel is really built for the ‘newer’ versions of PHP 5.3 and up. It makes heavy use of anonymous functions and namespaces. I think this is a positive – it’s not littered with code to make it compatible with old versions of PHP or hacky workarounds. It’s built for 5.3 and up and that’s that.

There’s all the usual stuff in there like MVC routing, clean URLS, an ORM, database abstraction. But there’s also some nice additions like database migrations so you DB changes can by checked into source control, built in support for Redis, convenient caching methods, sql and code profiler, a command line client for running either inbuilt tasks of ones that you write – using PHP on the command line has always annoyed me but using the Artisan CLI you can quickly run php from cron or a job queue.

There’s also a template engine. I know another one! But I actually find myself using this one. I’ve always steered clear of php template engines. After all PHP was originally designed to just be written into HTML files. But the blade template engine is pretty handy. It’s got a few helper bits for slightly neater loops, control statements, and a nice short hand for in the form of {{}}. If you use the layout feature you can also define sections that you fill in later from your views. It reminded me of templates in Django. It’s said that the templates are compiled but in fact the shorthand elements are just swapped for their PHP equivalents and cached for use.

So far I haven’t hit any major walls with regards to its flexibility. There seems to be enough scope in its implementation to allow you to just get on with writing your application while providing you with those little helpful pieces that you just don’t want to reinvent. Out of the box it’s pretty much ready to run and you don’t need to spend an age configuring it or building stuff up – it’s just ready to go. I do miss the cascading file system of Kohana – that made it easy to keep customisations and config settings out of bundles. (I think the bundle config issue is being dealt with). Anyway go and have a look at it.

Advertisements