Laravel 4 release
Hey Laravel users! Laravel version 4 has been released this Tuesday! I feel you cheering and smiling because this means a big leap forward for PHP developers.
There were over 570 users in IRC (hashtag laravel) when it was released and I was one of them! Also, my face is on the top row of laravel.com website which I am pretty happy about.
In this post I will provide some information on what has changed, recommend resources to get you started and give you source code of a Laravel 4 application that I made in just a couple of hours.
What’s new in Laravel 4?
First thing that you will notice is that Laravel uses Composer heavily. Laravel 4 itself consists of a set of Composer packages so it is now more modular and in turn more testable. Even though it might seem a bit harder to get started (since it requires to install composer) I believe there will be a standalone version ready to download from laravel’s site. I encourage you to try composer though, it is easy to get started with it : http://getcomposer.org/doc/00-intro.md
Laravel 4 is a lot more powerful and that power comes from new features such as :
- Using queues for processor heavy tasks (kind of like cron jobs but more flexible and could be offloaded to another server).
- Expanded Eloquent ORM operations like soft deletes, collections, scopes, better protection of passed data.
- Expanded Routing features such as pattern based filters, sub domain routing, model binding for routes.
- Change of syntax to conform to PSR-0 and PSR-1 standards. get_index is now getIndex, etc…
- Seeding of DB.
- Built in Mail component.
- Expanded Events features with ability to queue events and also addition of model events.
- Easy extension with over 7000 packages available through Composer (comparing to 200 bundles in L3).
- More unit tests (over 2000 tests for framework’s components) and more testable environment for your application.
- IoC container improvements.
What remains the same as in Laravel 3?
The eloquent and expressive syntax of the framework remains the same. Most of the functions have the same names but the method names are now camelCase instead of snake_case. The main maintainer of the framework is still Taylor Otwell who has a great vision for Laravel.
Should you upgrade your existing apps from Laravel 3 to version 4?
As some people say, “if it’s not broken, don’t fix it”. And I believe that to be true in case of upgrade. Laravel 3 is a perfectly good and stable framework, it is fast, has powerful Eloquent ORM and provides necessary devices to produce a working application. Laravel 4 is a lot more powerful in terms of scaling/queuing/offloading tasks, expandable through composer packages and a lot more future proof.
If your Laravel 3 application works well already, don’t upgrade it.
The documentation for Laravel version 3 was moved to this URL:
Laravel 4 release cycle:
|4.0||May 28, 2013|
Get started with Laravel 4:
You can get started by doing a 5 minute quickstart here:
Also, as promised, here is the application made with Laravel 4 the source of which I am releasing for free. Feel free to fork and improve on it:
http://laravel.com - the main site for Laravel 4
http://wiki.laravel.io/Changelog_(Laravel_4)#Methods – changes in Laravel 4 syntax
https://github.com/barryvdh/laravel-vendor-cleanup - cleans up vendor directory in case your hosting has very limited space
http://getcomposer.org/doc/ – composer documentation
http://composer.json.jolicode.com/ - composer interactive primer
PS, I will be updating my L3 blog posts and publishing them as I go.